A commercial-grade Flutter AI Agent SDK with multi-provider support, tool calling, and MCP (Model Context Protocol).
open_agent/ # Umbrella package (re-exports everything)
open_agent_core/ # Pure Dart SDK — no Flutter dependency
├── models/ # Message, Content, Tool, ChatEvent
├── client/ # ChatProvider interface + OpenAI adapter
├── agent/ # AgentLoop (tool calling cycle) + Session
└── mcp/ # MCP tool bridge
open_agent_ui/ # Flutter UI widgets (TODO)
example/ # Demo app
import 'package:open_agent_core/open_agent_core.dart';
// 1. Configure
final config = AgentConfig.openai(
apiKey: 'sk-...',
model: 'gpt-4o',
systemPrompt: 'You are a helpful assistant.',
);
// 2. Create session
final session = ChatSession(
config: config,
provider: OpenAiProvider(config),
);
// 3. Chat with streaming
await for (final event in session.send('Hello!')) {
switch (event) {
case TextDelta(:final text):
stdout.write(text); // Stream to UI
case ToolCallEvent(:final name):
print('Calling tool: $name');
case DoneEvent():
print('\n--- Done ---');
default:
break;
}
}final tools = ToolRegistry();
tools.register(ToolDefinition(
name: 'search',
description: 'Search the web',
parameters: {
'type': 'object',
'properties': {
'query': {'type': 'string', 'description': 'Search query'},
},
'required': ['query'],
},
executor: (args) async {
return await mySearchApi(args['query']);
},
));
final session = ChatSession(
config: config,
provider: OpenAiProvider(config),
tools: tools,
);
// The AgentLoop automatically:
// 1. Sends messages to the model
// 2. Detects tool call requests
// 3. Executes tools
// 4. Feeds results back
// 5. Repeats until final answerfinal mcpBridge = McpToolBridge();
// Connect to an MCP server (e.g. filesystem, database, etc.)
await mcpBridge.connectServer(
name: 'filesystem',
transport: StdioTransport(command: 'npx', args: ['-y', '@anthropic/mcp-filesystem']),
);
// Register all MCP tools into the agent
mcpBridge.registerAll(tools);
// Now the agent can use MCP tools transparently!Any OpenAI-compatible API works out of the box:
| Provider | Base URL |
|---|---|
| OpenAI | https://api.openai.com/v1 |
| DeepSeek | https://api.deepseek.com/v1 |
| Groq | https://api.groq.com/openai/v1 |
| Ollama | http://localhost:11434/v1 |
| Together | https://api.together.xyz/v1 |
- Core SDK (pure Dart)
- OpenAI-compatible provider
- Tool calling agent loop
- MCP client bridge
- Anthropic native provider
- Google Gemini native provider
- Flutter UI widget library
- Audio/TTS support
- Persistent sessions (SQLite)
- Token budget / context window management
- Architecture Design — 完整架构设计文档
- OpenClaw Study — OpenClaw 源码研究笔记
- Design Decisions — 关键设计决策记录
MIT