Knowledge
AgentOS turns a Knowledge instance into an operational HTTP surface for content management and semantic search. This lesson serves one local knowledge base, shares it with an agent, and closes the full REST lifecycle rather than stopping at application construction.
Content
Knowledge
AgentOS turns a Knowledge instance into an operational HTTP surface for content management and semantic search. This lesson serves one local knowledge base, shares it with an agent, and closes the full REST lifecycle rather than stopping at application construction.
Files
| File | What it teaches | |---|---| | basic.py | Serve one SQLite- and Chroma-backed knowledge base shared with an agent. | | rest_api_knowledge.py | Upload, poll, list, search, delete, and verify knowledge content over HTTP. |
Prerequisites
Set OPENAI_API_KEY. The server uses text-embedding-3-small when it seeds and uploads content, and its served agent uses OpenAI Responses gpt-5.5. SQLite stores content metadata in tmp/knowledge.db; Chroma stores vectors under tmp/knowledge_chroma.
Run
Start the server:
.venvs/demo/bin/python cookbook/05_agent_os/10_knowledge/basic.py
In another terminal, run the lifecycle client:
.venvs/demo/bin/python cookbook/05_agent_os/10_knowledge/rest_api_knowledge.py
The client first verifies /health and /config, then uses only concrete knowledge routes:
POST /knowledge/contentaccepts form data and returns202.GET /knowledge/content/{content_id}/statusreports background processing.GET /knowledge/contentlists the stored item in a{data, meta}envelope.POST /knowledge/searchsearches the vector store with a JSON body.DELETE /knowledge/content/{content_id}removes the item, and a finalGET /knowledge/content/{content_id}returns404.
Because this AgentOS exposes exactly one knowledge base, db_id and knowledge_id are optional on these calls. Applications serving multiple knowledge bases must select one with those identifiers.
Source and license
- Source
- Agno
- Original
- agno-agi/agno/cookbook/05_agent_os/10_knowledge
- License
- Apache-2.0