Python SDK
Look up the common APIs for calling an Agent from a Python application. For model setup, runnable examples, and expected results, see Call an Agent with the Python SDK.
Prepare the runtime
| Call | Behavior |
|---|---|
prepare_runtime() |
Read the configuration from DataAgent Home and return a runtime for create_agent(). |
prepare_runtime(LaunchOptions(config=path)) |
Use the specified product YAML. |
Create and call an Agent
create_agent(runtime) returns an Agent. agent.invoke(inputs, config=...) runs one turn synchronously and returns the final graph state. For a normal conversation, send the new message in inputs["messages"] and read the reply from the returned messages. Use with to manage the Agent lifecycle.
Select a session
Set config["configurable"]["thread_id"] to select the session. Use a different ID to start a new session. To continue a conversation, reuse its ID and configure a persistent SQLite checkpointer. See the Python SDK usage guide.
Async and streaming calls
ainvoke() waits for the final result. astream() yields updates while the Agent runs, so a client can display progress. See the async and streaming example.
If configuration fails, check your model settings and YAML. See model configuration and first call.
Extension and host development
- Python extension APIs · Tool context, models, SemanticLayer, and data access.
- Python human interaction API · Handlers, interrupts, and resume actions.
- A2A Python client · Send messages to a remote Agent, reuse context, and handle errors.
- Python host and graph APIs · Logging, extension refresh, AG-UI adapters, and native graph assembly.