At a glance
How they compose
Pipelines and Agents are top-level objects you save to the platform. Sessions live on top of conversational Agents and Chatbots. Knowledge Bases are referenced from either.Pipeline
Pipeline overview
Build with
p.add.input / .llm / .output / …, then save() and run() or stream().Pipeline is the right primitive when the steps are known up front. The add builder is fluent and typed — the mypy plugin catches wiring mistakes statically.
Agent
Agent overview
An LLM with tools, instructions, and typed inputs/outputs.
- Functional — single call. You pass inputs, the agent decides which tools to call, you get outputs.
- Conversational — multi-turn. The agent holds a
Sessionand emits streaming events.
Session
Session overview
Multi-turn streaming handle returned by
agent.create_session() or chatbot.create_session().Session is an async context manager. You send() and listen() for events — message deltas, tool calls, tool results, approval requests, errors.
Knowledge Base
Knowledge Base reference
Create, query, index documents from Python.
KnowledgeBase is a managed store of documents (files, URLs, Wikipedia, YouTube, Arxiv) with vector + keyword search. Query it directly, or reference it from a Pipeline node or an Agent tool.
Picking the right primitive
1
Is the flow fixed?
If yes → Pipeline. If no (the model decides next step) → Agent.
2
Do you need turn-by-turn streaming?
If yes → put the Agent behind a Session. If no, call
agent.run() once.3
Are you reading documents?
Use a Knowledge Base. Reference it from a Pipeline node, an Agent tool, or query it directly.
What’s next
Quickstart
Ship a pipeline in 60 seconds.
Pipeline overview
Build your first graph.
Agent overview
Tools, sessions, streaming.
