Agent / Expose, do not reimplement

Serving one contract across four protocols

Bind once, then mount any combination of protocol adapters:

Caller environmentPackageExposed surface
In-page browser agentfoldkit-agent-webmcpdocument.modelContext WebMCP tool
External MCP clientfoldkit-agent-mcptools/list / tools/call (stdio or HTTP)
External A2A agentfoldkit-agent-a2aAgent Card skill and task handler
Agent Native hostfoldkit-agent-nativeAgent Native package action
ts
import { AgentA2a } from 'foldkit-agent-a2a'
import { AgentMcp } from 'foldkit-agent-mcp'
import { AgentWebMcp } from 'foldkit-agent-webmcp'

AgentWebMcp.register({ agent: agentRuntime })
AgentMcp.stdio({ agent: agentRuntime })
AgentA2a.handler({ agent: agentRuntime })

For multi-tenant hosts like Agent Native, resolve a runtime per caller:

ts
import { AgentNative } from 'foldkit-agent-native'
import { registerPackageActions } from '@agent-native/core/server'

registerPackageActions(
  AgentNative.actions({
    definition: AssistantAgent,
    resolveRuntime,
  }),
)

Adapters derive tool schemas directly from your contract and forward calls straight into the shared pipeline.