Once FoundrySettings is configured, you can define agents and run interactive sessions.
Defining an Agent:
Agents are created via POST /agents. Tools in the tools array are namespaced:
mcp:<tool-name>: Routes to a tool registered via /tools.agent:<agent-name>: Delegates to another agent (subagent/Task pattern).builtin:bash, builtin:read_file, builtin:write_file: In-process built-in tools.
POST /agents
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "weather-helper",
"model": "gpt-4o",
"system": "You answer weather questions concisely.",
"tools": ["mcp:weather"],
"description": "Demo agent backed by the weather MCP tool."
}
Running a Session:
Start a session using POST /sessions/run. This returns a Server-Sent Events (SSE) stream. Event types include Started, ToolCallStarted, ToolCallCompleted, TokenDelta, Completed, and Failed.
POST /sessions/run
Authorization: Bearer <token>
Content-Type: application/json
Accept: text/event-stream
{ "agentName": "weather-helper", "input": "What's the weather in Seattle?" }
Continuing a Session:
To send a follow-up message to an existing session, use POST /sessions/{id}/messages.
POST /sessions/{id}/messages
Content-Type: application/json
{ "input": "And in Portland?" }