Guides

Examples

Real runnable examples from this repo. Start with a live app if you want product behavior fast, then use script-level examples for focused SDK verification.

Prerequisites for live examples

terminal
# Orbit API stack up
# (from repo root)
docker compose up --build

# Ollama running locally
# and a root .env file with:
ORBIT_JWT_TOKEN=<your-jwt>
ORBIT_API_BASE_URL=http://localhost:8000
OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=llama3.1

Cloud route alternative: get ORBIT_API_KEY from Dashboard and set ORBIT_API_BASE_URL to your hosted endpoint.

Live Product Simulations

live_meal_coach_ollamaexamples/live_meal_coach_ollama/

Consumer-facing product simulation with two modes: baseline vs orbit memory.

Run

python -m uvicorn examples.live_meal_coach_ollama.app:app --reload --port 8020

View on GitHub

Verify: Compare response quality and context preview between baseline/orbit modes.

live_chatbot_ollamaexamples/live_chatbot_ollama/

Coding tutor with retrieval inspector and memory feedback in browser UI.

Run

python -m uvicorn examples.live_chatbot_ollama.app:app --reload --port 8010

View on GitHub

Verify: Verify retrieval ordering and feedback loop from the UI.

Direct API (No SDK)

Use these when you want Orbit from Node.js, Go, or custom runtimes without the Python SDK.

direct-orbit-api.js
const headers = {
  Authorization: `Bearer ${process.env.ORBIT_API_KEY}`,
  "Content-Type": "application/json",
  Accept: "application/json",
};

await fetch(`${process.env.ORBIT_API_BASE_URL}/v1/ingest`, {
  method: "POST",
  headers,
  body: JSON.stringify({
    content: "I prefer short debugging checklists.",
    event_type: "user_preference",
    entity_id: "alice",
  }),
});

const retrieve = await fetch(
  `${process.env.ORBIT_API_BASE_URL}/v1/retrieve?query=What%20should%20I%20know%20about%20alice?&entity_id=alice&limit=5`,
  { headers },
);
nodejs_orbit_api_chatbotexamples/nodejs_orbit_api_chatbot/

Complete Node.js browser chatbot that uses Orbit REST endpoints with API key auth (no SDK).

Run

cd examples/nodejs_orbit_api_chatbot && cp .env.example .env && npm install && npm run dev

View on GitHub

Verify: Open localhost:8030 and verify ingest/retrieve/feedback loop with assistant memory ids.

node_fetch.mjsexamples/http_api_clients/node_fetch.mjs

Single-file Node.js direct API integration using fetch.

Run

cd examples/http_api_clients && cp .env.example .env && npm install && npm run node-example

View on GitHub

Verify: Confirms direct API key auth and retrieval payload parsing.

python_http.pyexamples/http_api_clients/python_http.py

Python requests example for teams not using the Orbit SDK.

Run

cd examples/http_api_clients && cp .env.example .env && python -m pip install requests && python python_http.py

View on GitHub

Verify: Confirms ingest and retrieve via raw HTTP in Python.

go_http.goexamples/http_api_clients/go_http.go

Go net/http example for service-to-service Orbit integration.

Run

cd examples/http_api_clients && cp .env.example .env && go run go_http.go

View on GitHub

Verify: Confirms Go clients can call Orbit endpoints with API key auth.

Core SDK Scripts

basic_usage.pyexamples/basic_usage.py

Smallest possible ingest + retrieve loop using MemoryEngine.

Run

python examples/basic_usage.py

View on GitHub

Verify: Confirms SDK wiring and core request flow.

async_usage.pyexamples/async_usage.py

Async client usage with AsyncMemoryEngine in event-loop apps.

Run

python examples/async_usage.py

View on GitHub

Verify: Confirms async ingest/retrieve works cleanly.

batch_operations.pyexamples/batch_operations.py

Batch ingest and batch feedback workflows for higher throughput.

Run

python examples/batch_operations.py

View on GitHub

Verify: Confirms ingest_batch + feedback_batch response handling.

feedback_loop.pyexamples/feedback_loop.py

Simple positive feedback write after retrieval.

Run

python examples/feedback_loop.py

View on GitHub

Verify: Confirms memory_id feedback integration.

personalization_quickstart.pyexamples/personalization_quickstart.py

Repeated-signal + feedback flow to trigger inferred memories.

Run

python examples/personalization_quickstart.py

View on GitHub

Verify: Confirms inferred pattern/preference memory surfacing.

Integration Templates

agent_integration.pyexamples/agent_integration.py

FastAPI chatbot pattern with Orbit + OpenAI call flow.

Run

python examples/agent_integration.py

View on GitHub

Verify: Use as implementation template (requires provider credentials).

Recommended evaluation order

>

Run live_meal_coach_ollama first to feel consumer-facing personalization (baseline vs orbit).

>

Run live_chatbot_ollama to inspect retrieval ordering and memory feedback behavior.

>

Run nodejs_orbit_api_chatbot to validate direct Orbit API integration with a non-Python app.

>

Run examples/http_api_clients scripts when checking language-specific raw HTTP integration.

>

Run personalization_quickstart.py to verify inferred-memory generation from repeated signals.

>

Run batch_operations.py when validating throughput-oriented integration paths.