Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/my-website/docs/integrations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This section covers integrations with various tools and services that can be used with LiteLLM (either Proxy or SDK).

## AI Agent Frameworks
- **[AgentField](../tutorials/agentfield.md)** - Open-source control plane for building and orchestrating autonomous AI agents
- **[Letta](./letta.md)** - Build stateful LLM agents with persistent memory using LiteLLM Proxy

## Development Tools
Expand All @@ -15,4 +16,4 @@ This section covers integrations with various tools and services that can be use
- **[Datadog](../observability/datadog.md)**


Click into each section to learn more about the integrations.
Click into each section to learn more about the integrations.
124 changes: 124 additions & 0 deletions docs/my-website/docs/tutorials/agentfield.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Comment on lines +1 to +2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused JSX imports

Tabs and TabItem are imported at the top of the file but are never used anywhere in the document. In Docusaurus this can produce build warnings. These two lines should be removed.

Suggested change
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';


# AgentField with LiteLLM

Use [AgentField](https://agentfield.ai) with any LLM provider through LiteLLM.

AgentField is an open-source control plane for building and orchestrating autonomous AI agents, with SDKs for Python, TypeScript, and Go. AgentField's Python SDK uses LiteLLM internally for multi-provider LLM support.

## Overview

AgentField's Python SDK uses `litellm.acompletion()` under the hood, giving you access to 100+ LLM providers out of the box:

- Use any LiteLLM-supported model (OpenAI, Anthropic, Azure, Bedrock, Ollama, etc.)
- Switch between providers by changing the model string
- All LiteLLM features (caching, fallbacks, routing) work automatically

## Prerequisites

- Python 3.9+
- API keys for your LLM providers
- AgentField control plane (optional, for orchestration features)

## Installation

```bash
pip install agentfield
```

## Quick Start

### Basic Agent with OpenAI

```python
from agentfield import Agent, AgentConfig

config = AgentConfig(
name="my-agent",
model="gpt-4o", # Any LiteLLM-supported model
instructions="You are a helpful assistant."
)

agent = Agent(config)
response = await agent.run("Hello, world!")
```
Comment on lines +34 to +45
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await used outside an async context

The snippet uses await agent.run(...) at the top level of a code block without wrapping it in an async def function. In Python, await expressions are only valid inside async def functions (or in an async REPL like IPython). Running this code as a plain .py script will raise a SyntaxError.

The example should either wrap the call in an async def main() function and use asyncio.run(), or show the synchronous variant if one exists.

Suggested change
```python
from agentfield import Agent, AgentConfig
config = AgentConfig(
name="my-agent",
model="gpt-4o", # Any LiteLLM-supported model
instructions="You are a helpful assistant."
)
agent = Agent(config)
response = await agent.run("Hello, world!")
```
import asyncio
from agentfield import Agent, AgentConfig
config = AgentConfig(
name="my-agent",
model="gpt-4o", # Any LiteLLM-supported model
instructions="You are a helpful assistant."
)
async def main():
agent = Agent(config)
response = await agent.run("Hello, world!")
asyncio.run(main())


### Using Anthropic

```python
config = AgentConfig(
name="claude-agent",
model="anthropic/claude-sonnet-4-20250514", # LiteLLM model format
instructions="You are a helpful assistant."
)
```

### Using Ollama (Local Models)

```python
config = AgentConfig(
name="local-agent",
model="ollama/llama3.1", # LiteLLM's ollama/ prefix
instructions="You are a helpful assistant."
)
```

### Using Azure OpenAI

```python
config = AgentConfig(
name="azure-agent",
model="azure/gpt-4o", # LiteLLM's azure/ prefix
instructions="You are a helpful assistant."
)
```

### Using with LiteLLM Proxy

Point AgentField to a LiteLLM Proxy for centralized model management:

```python
import os

os.environ["OPENAI_API_BASE"] = "http://0.0.0.0:4000" # LiteLLM Proxy URL
os.environ["OPENAI_API_KEY"] = "sk-1234" # LiteLLM Proxy key

config = AgentConfig(
name="proxy-agent",
model="gpt-4o", # Virtual model name from proxy config
instructions="You are a helpful assistant."
)
```

## Multi-Agent Orchestration

AgentField's control plane orchestrates multiple agents, each potentially using different LLM providers:

```python
from agentfield import Agent, AgentConfig, ControlPlane

# Create agents with different providers
researcher = Agent(AgentConfig(
name="researcher",
model="anthropic/claude-sonnet-4-20250514",
instructions="You research topics thoroughly."
))

writer = Agent(AgentConfig(
name="writer",
model="gpt-4o",
instructions="You write clear, concise content."
))

# Register with control plane
cp = ControlPlane(server="http://localhost:8080")
cp.register(researcher)
cp.register(writer)
```

## Links

- [Documentation](https://agentfield.ai/docs)
- [GitHub](https://github.com/Agent-Field/agentfield)
- [Python SDK](https://github.com/Agent-Field/agentfield/tree/main/sdk/python)
1 change: 1 addition & 0 deletions docs/my-website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ const sidebars = {
slug: "/agent_sdks"
},
items: [
"tutorials/agentfield",
"tutorials/openai_agents_sdk",
"tutorials/claude_agent_sdk",
"tutorials/copilotkit_sdk",
Expand Down
Loading