22 lines
1.4 KiB
Markdown
22 lines
1.4 KiB
Markdown
┌─────────────────────────────────────────────────┐
|
|
│ Agent Harness (your servers) │
|
|
│ │
|
|
│ on_message(user_id, message): │
|
|
│ 1. Look up user's MCP endpoint from Postgres │
|
|
│ 2. mcp.call("get_context_summary") │
|
|
│ 3. mcp.call("get_conversation_history", 20) │
|
|
│ 4. Build prompt: │
|
|
│ system = BASE_PROMPT │
|
|
│ + context_summary │
|
|
│ + user_agent_prompt (from MCP) │
|
|
│ messages = history + new message │
|
|
│ 5. LLM call (your API key) │
|
|
│ 6. While LLM wants tool calls: │
|
|
│ - Platform tools → handle locally │
|
|
│ - User tools → proxy to MCP │
|
|
│ - LLM call again with results │
|
|
│ 7. mcp.call("save_message", ...) │
|
|
│ 8. Return response to user │
|
|
│ │
|
|
└─────────────────────────────────────────────────┘
|