AgentKit
框架 | 用途 | 核心特性 |
框架 | 用途 | 核心特性 |
AgentkitSimpleApp | 标准Agent应用 | 简单易用,@app.entrypoint装饰器。 |
AgentkitMCPApp | MCP工具服务 | @app.tool装饰器,工具封装。 |
AgentkitA2aApp | A2A通信 | @app.agent_executor装饰器。 |
AgentkitAgentServerApp | 完整服务端 | 集成ADK Web Server,支持A2A。 |
参数 | 类型 | 必填 | 说明 |
参数 | 类型 | 必填 | 说明 |
app_name | string | 是 | Agent应用名称。 |
user_id | string | 是 | 用户唯一标识。 |
session_id | string | 否 | 会话唯一标识(创建会话时可省略)。 |
new_message | Content | 是 | 用户消息内容,支持多模态。具体请参见“new_message”结构。 |
streaming | boolean | 否 | 是否使用流式响应,默认false。 |
state_delta | dict | 否 | 状态更新(可选)。 |
invocation_id | string | 否 | 调用ID,用于恢复长时间运行的函数(可选)。 |
参数 | 类型 | 必填 | 说明 |
参数 | 类型 | 必填 | 说明 |
parts | list[Part] | 是 | 消息内容部分列表,每个part可以是不同类型(文本、图片、文件等)。具体请参见“Part”结构。 |
role | string | 否 | 内容的生产者,必须是user或model,用于多轮对话。如果不设置,系统会自动推断。
|
Python代码 | JSON字段 | 类型 | 说明 |
Python代码 | JSON字段 | 类型 | 说明 |
types.Part(text="...") | {"text": "..."} | String | 纯文本内容。 |
types.Part(inline_data=...) | {"inlineData": {...}} | Blob | 内联数据(如Base64编码的图片、视频等)。 |
types.Part(file_data=...) | {"fileData": {...}} | FileData | 文件引用(通过URI访问)。 |
types.Part(function_call=...) | {"functionCall": {...}} | FunctionCall | 函数调用。 |
types.Part(function_response=...) | {"functionResponse": {...}} | FunctionResponse | 函数响应。 |
types.Part(executable_code=...) | {"executableCode": {...}} | ExecutableCode | 可执行代码。 |
types.Part(code_execution_result=...) | {"codeExecutionResult": {...}} | CodeExecutionResult | 代码执行结果。 |
types.Part(thought=...) | {"thought": true/false} | Boolean | 指示是否为模型的思考。 |
types.Part(thought_signature=...) | {"thoughtSignature": "..."} | Bytes | 思考的签名,用于后续请求。 |
types.Part(media_resolution=...) | {"mediaResolution": {...}} | PartMediaResolution | 输入媒体的分辨率。 |
types.Part(video_metadata=...) | {"videoMetadata": {...}} | VideoMetadata | 视频元数据(仅在提供视频数据时使用)。 |