Python client for the daimon AI sidecar
Project description
daimon-client
Python client for Daimon — a pluggable AI sidecar runtime.
Installation
pip install daimon-client
Quick start
from daimon_client import Client
with Client(base_url="http://localhost:3500") as c:
reply = c.chat("claude", "What is a daimon?")
print(reply)
Async
import asyncio
from daimon_client import AsyncClient
async def main():
async with AsyncClient(base_url="http://localhost:3500") as c:
reply = await c.chat("claude", "What is a daimon?")
print(reply)
asyncio.run(main())
Streaming
with Client() as c:
for text in c.stream("claude", "Tell me a story."):
print(text, end="", flush=True)
Multi-turn conversations
Pass a list of messages to carry history yourself:
reply = c.chat("claude", [
{"role": "user", "content": "My name is Alice."},
{"role": "assistant", "content": "Nice to meet you, Alice!"},
{"role": "user", "content": "What is my name?"},
])
Sessions
Let the sidecar maintain history server-side with a session_id:
c.chat("claude", "My favourite colour is blue.", session_id="chat-1")
reply = c.chat("claude", "What is my favourite colour?", session_id="chat-1")
# reply contains "blue"
c.clear_session("chat-1")
Inference parameters
All sampling parameters are optional and fall back to the component's configured defaults:
reply = c.chat("gpt4o", "Summarise this.", model="gpt-4o", temperature=0.2, max_tokens=256)
Vector store (memory)
Read and write documents in a configured vector store:
mem = c.memory("my-store")
# Upsert a document (returns the assigned ID)
doc_id = mem.upsert("The Eiffel Tower is 330 metres tall.", id="eiffel", metadata={"source": "wikipedia"})
# Semantic search
results = mem.query("tall Paris structures", top_k=3)
for r in results:
print(f"{r.score:.3f} {r.content}")
# Delete
mem.delete("eiffel")
Async vector store
async with AsyncClient() as c:
mem = c.memory("my-store")
await mem.upsert("Some content")
results = await mem.query("my query")
Graph store
Interact with a configured graph database using Cypher:
kg = c.graph("knowledge-graph")
# Add nodes
kg.add_node(id="alice", labels=["Person"], props={"name": "Alice", "age": 30})
kg.add_node(id="bob", labels=["Person"], props={"name": "Bob"})
# Add a relationship
kg.add_edge("alice", "bob", "KNOWS", props={"since": "2020"})
# Run a Cypher query
rows = kg.cypher(
"MATCH (a:Person)-[:KNOWS]->(b) RETURN a.name AS from, b.name AS to"
)
print(rows) # [{"from": "Alice", "to": "Bob"}]
# Delete a node (and all its relationships)
kg.delete_node("alice")
API reference
Client(base_url?, timeout?)
| Parameter | Default |
|---|---|
base_url |
http://127.0.0.1:3500 |
timeout |
120.0 seconds |
Use as a context manager (with Client() as c) or call c.close() manually.
c.chat(component, prompt, **kwargs) → str
Returns the full response text.
prompt can be a str or a list of {"role": ..., "content": ...} dicts.
c.stream(component, prompt, **kwargs) → Iterator[str]
Yields text fragments as they arrive.
c.clear_session(session_id) → None
Deletes server-side session history. Safe to call on a non-existent session.
c.memory(store) → MemoryStoreClient
Returns a client scoped to the named vector store.
| Method | Description |
|---|---|
upsert(content, *, id?, metadata?) |
Insert or update a document. Returns the document ID. |
query(query, top_k=5) |
Semantic search. Returns list[MemoryResult] sorted by descending score. |
delete(id) |
Delete a document by ID. |
c.graph(store) → GraphStoreClient
Returns a client scoped to the named graph store.
| Method | Description |
|---|---|
add_node(*, id?, labels?, props?) |
Add or update a node. Returns the node ID. |
add_edge(from_id, to_id, rel_type, *, props?) |
Create a directed relationship. |
cypher(query, params?) |
Run a Cypher query. Returns list[dict]. |
delete_node(id) |
Delete a node and all its relationships. |
Keyword arguments for chat / stream
| Argument | Description |
|---|---|
model |
Override the component's default model |
system |
System prompt shorthand |
max_tokens |
|
temperature |
|
top_p |
|
top_k |
Anthropic only |
stop |
List of stop sequences |
frequency_penalty |
|
presence_penalty |
|
seed |
|
session_id |
Server-side session ID |
AsyncClient mirrors Client with async def methods and async for streaming.
Links
License
Apache-2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file daimon_client-0.3.0.tar.gz.
File metadata
- Download URL: daimon_client-0.3.0.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
751bce1e4e35793ac9bf4038331c07541a071efbd4c297a9aa6295d39b1508e0
|
|
| MD5 |
18bfe1d2a75473a4c297c53d8303174a
|
|
| BLAKE2b-256 |
c474cb93bf58761d69ac872c4086494f50c22c78f37ba18093253e076f74ce2c
|
Provenance
The following attestation bundles were made for daimon_client-0.3.0.tar.gz:
Publisher:
publish-python.yml on sonicboom15/daimon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
daimon_client-0.3.0.tar.gz -
Subject digest:
751bce1e4e35793ac9bf4038331c07541a071efbd4c297a9aa6295d39b1508e0 - Sigstore transparency entry: 1518941508
- Sigstore integration time:
-
Permalink:
sonicboom15/daimon@a019929d3d6acf2a33bda91db8895268e117475b -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/sonicboom15
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@a019929d3d6acf2a33bda91db8895268e117475b -
Trigger Event:
push
-
Statement type:
File details
Details for the file daimon_client-0.3.0-py3-none-any.whl.
File metadata
- Download URL: daimon_client-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2601dc48d930245623ffde9567831c1cc640e7610ca8a5716842731907a34743
|
|
| MD5 |
caef80a16f5917b0f098e551ffd564d1
|
|
| BLAKE2b-256 |
51a0fc89a0dec1b56462f5fb1d8b40a7a964f5d5faf2246d069a042b613bfd1b
|
Provenance
The following attestation bundles were made for daimon_client-0.3.0-py3-none-any.whl:
Publisher:
publish-python.yml on sonicboom15/daimon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
daimon_client-0.3.0-py3-none-any.whl -
Subject digest:
2601dc48d930245623ffde9567831c1cc640e7610ca8a5716842731907a34743 - Sigstore transparency entry: 1518941622
- Sigstore integration time:
-
Permalink:
sonicboom15/daimon@a019929d3d6acf2a33bda91db8895268e117475b -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/sonicboom15
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@a019929d3d6acf2a33bda91db8895268e117475b -
Trigger Event:
push
-
Statement type: