Federation & Service

Federation & Service

Downcity AI 基础设施中 Federation 和 Service 是什么

Federation & Service

Federation 是 City 中的模型抽象层。它提供一个统一的接口,覆盖多个 AI 提供商(OpenAI、Anthropic、Google、本地模型等),让 Agent 无需硬编码提供商专属 API。

Federation AIService

Federation AIService 是 City 的一个组件,负责:

  • 注册模型提供商及其能力
  • 无论后端是什么,都暴露统一的模型 API
  • 追踪用量并将请求路由到合适的提供商
  • 处理故障转移和速率限制

Agent 通过类似 "default""quality" 的 ID 绑定模型。Federation AIService 在运行时将该 ID 解析为实时模型实例。

Service / Action 基础设施

City 还提供了一个通用的 ServiceAction 层,用于构建 Agent 可调用的后端能力:

  • Service — 长期运行的后端能力(例如知识库、搜索引擎、数据库)
  • Action — Agent 可调用的离散操作(例如发送邮件、查询数据库、调用外部 API)

Service 和 Action 向 City 注册,可被任何已连接的 Agent 发现和调用。

与 City 的关系

Federation 是 City 的子系统。当你使用 City SDK 时,你在交互的是:

  • City 身份与认证
  • Federation AIService(模型目录和路由)
  • Service/Action 基础设施(后端能力)
  • 用量、余额和计费(City Services)

继续阅读

  • City SDK — 构建在 City 和 Federation 之上
  • Payments — 用量、余额和计费 API