import asyncio
from definable.agent import Agent
from definable.knowledge import Knowledge
from definable.vectordb import InMemoryVectorDB
# Create knowledge base
knowledge = Knowledge(vector_db=InMemoryVectorDB())
# Add documents
knowledge.add("Definable is a Python framework for building AI agents.")
knowledge.add("It supports 10 LLM providers including OpenAI, Anthropic, and Google.")
knowledge.add("Agents can use tools, knowledge, memory, middleware, and tracing.")
knowledge.add("The @tool decorator converts Python functions into agent-callable tools.")
# Create agent with knowledge
agent = Agent(
model="gpt-4o",
knowledge=knowledge,
instructions="Answer questions using the provided knowledge base. Cite specific facts.",
)
async def main():
output = await agent.arun("What LLM providers does Definable support?")
print(output.content)
asyncio.run(main())