Demo video

SF Agent Platform walkthrough

SF Agent Platform is a multi-service support stack: a FastAPI backend for chat, tickets, and user APIs; a FastMCP server that exposes operational tools to a Bedrock-powered agent; a Next.js dashboard for users, chat, and tickets; and a background ticket scheduler that triages pending tickets and can run automated account actions.


Capabilities

  • Create user accounts (Salesforce-backed with a local store mirror).
  • Trigger password-reset email flows.
  • Create and list support tickets.
  • Run Bedrock-assisted triage over pending tickets.

Architecture

Backend (backend/)

On startup the app bootstraps Salesforce tokens, initializes the ticket database, optionally starts the scheduler, loads MCP tools from MCP_SERVER_URL via langchain-mcp-adapters, and wraps async MCP tools for sync invoke() where needed. API surface includes chat (SSE and WebSocket), user tooling routes (create-user, OTP, password reset), tickets CRUD, and user listing.

Bedrock and the conversation agent

The LLM uses ChatBedrockConverse with model and region from environment configuration. The conversation agent combines tool-calling with session-scoped memory, pulling tools only from the MCP registry, with guardrails for confirmations, field extraction from prior turns, retries on hollow responses, and fallback direct tool invocation when structured data is already present.

MCP tool layer (mcp_server/)

The MCP server registers tools such as user registration, password-reset help, listing tickets, and creating support tickets—served over HTTP MCP transport. Handlers return normalized string outcomes (SUCCESS, FAILED, TOOL_INCOMPLETE) so the model can paraphrase results deterministically.

Tickets and scheduler

Tickets persist in PostgreSQL with statuses such as pending, decline, and resolved. The scheduler runs Bedrock triage on pending items: optional automated account actions (registration or reset flows inferred from ticket text), strict parse of DECISION and REPLY, then status and agent_reply updates.

Dashboard (dashboard/)

The Next.js App Router frontend talks to the backend via a shared API layer; state includes persisted chat sessions with streaming, and cached users with TTL. Primary routes cover users, chat, ticket creation, and ticket detail views.


Configuration

Backend settings cover Bedrock (AWS_REGION, BEDROCK_MODEL_ID, optional explicit AWS credentials), MCP (MCP_SERVER_URL), database (DATABASE_URL), Salesforce, and the ticket scheduler (TICKET_SCHEDULER_ENABLED, TICKET_SCHEDULER_INTERVAL_SECONDS).

Note

For production, run the MCP server and backend as separate processes, ensure Bedrock access and IAM permissions, prefer IAM roles over long-lived keys, tighten CORS and authentication, and externalize OTP storage (for example Redis) if you scale horizontally.


Testing

The backend includes coverage for the conversation agent, ticket triage, tickets and tools APIs, OTP flows, and integration-style chat tests (some paths may need alignment with current /api/chat routes).

Comments

One comment per visitor. Edit or delete your own comment anytime.

0/2000
Loading comments...
0
0
0
0