* feat: ModelClient and content types * refactor: Pythonify ChatResponseFormat and ChatRole * feat: Add guardrail interfaces * refactor: Remove CancellationToken * feat: Solidify the Usage APIs * Adds well-known keys for additional_counts, and guidance for how to avoid collisions between providers * Implement sum-aggregation for usage * refactor: Move AITool out of model_client * refactor: Copy editing * fix: CI checks (pyupgrade, ruff, etc.) * ci: Fix pre-commit to use pyright in uv venv The existing pyright precommit hook inside of python-pyright is no longer being maintained by the owner (see https://github.com/RobertCraigie/pyright-python/issues/265) The fix is to define the hook ourselves, relying on `uv run` to drive it. In order for that to work right we need to use the "system" language to break out of the sandbox. * fix: Pyright error fixes * docs: Update models and types design docs * Python: Refinement of content types and model client (#112) * refinement of structure and buildup with ports from semantigen * refined the data and uri contents * refined chat response and updates * moved things and added tests * moved out of src folder * fixed imports and tests * small tweaks * missing build system * upgrade * add mypy * fixed typing for types * fix tests * fixed tool * disable json checks on vscode * remove print --------- Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com> Co-authored-by: eavanvalkenburg <github@vanvalkenburg.eu>
Agent Framework Design Doc
What values does the framework provide?
- A set of configurable, extensible and high-quality components (e.g., model clients, tools, MCP servers and memory).
- An easy path for deploying, securing and scaling applications, both locally and in the cloud.
- Integration with tools for monitoring, debugging, evaluation and optimization, both locally and in the cloud.
- A community of developers and users for support, ideas, and contributions, benefiting everyone in the ecosystem.
What is this document?
- An overview of the new framework.
- Defining the major elements of the framework and their relationships.
- Detailed design of each element and its implementation will be in a separate document.
Core Data Types
To unify the interaction between components, we define a set of core data types that are used throughout the framework.
See Core Data Types for more details.
Components
A component is a class that provides a specific functionality and can be used independently by applications. There are two types of components in the framework: agent components and agents. Agent components are the building blocks of agents, while agents are the higher-level components, and can be composed from agent components and other agents (as in workflows).
The framework defines the following components. Follow the links to find the design details of each component:
- Agent Components:
- Agent and Workflow:
Composition
Components can be composed to create complex components. For example, an agent can be composed from model clients, tools and memory, and a tool can be composed from an agent or a workflow. It is the responsibility of the framework to validate components and their composition.
Configuration
A component can be created from a set of serializable configuration parameters, with the help of dependency injection to resolve non-serializable dependencies.
Relationships
The following diagram shows the component relationship of the framework:
graph TD
Component[Component] --> |extends| Agent[Agent]
Agent --> |extends| Workflow[Workflow]
Component --> |extends| ModelClient[Model Client]
Component --> |extends| VectorStore[Vector Store]
Component --> |extends| EmbeddingClient[Embedding Client]
Component --> |extends| Tool[Tool]
Component --> |extends| MCPServer[MCP Server]
Component --> |extends| ContextProvider[Context Provider]
Component --> |extends| Thread[Thread]
Component --> |extends| Guardrail[Guardrail]
Agent --> |uses| uses1[Model Client]
Agent --> |uses| uses2[Thread]
Agent --> |uses| uses3[Tools and MCP Servers]
Agent --> |uses| uses4[Context Provider]
Agent --> |uses| uses5[Guardrail]
Workflow --> |contains| contains[Child Agents]
ContextProvider --> |uses| uses5[Vector Store]
VectorStore --> |uses| uses6[Embedding Client]