Skip to content

Agent Quick Start

Create and chat with your first AI agent in 5 minutes.

Prerequisites

Step 1: Create an Agent

bash
curl -s -X POST https://api.universalapi.co/agent/create \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "agentName": "my-first-agent",
    "description": "A helpful assistant that answers questions",
    "sourceCode": "import os\nfrom strands import Agent\nfrom strands.models.bedrock import BedrockModel\n\ndef create_agent():\n    model = BedrockModel(\n        model_id=\"us.anthropic.claude-sonnet-4-20250514-v1:0\",\n        region_name=\"us-east-1\"\n    )\n    agent = Agent(\n        model=model,\n        system_prompt=\"You are a helpful assistant. Be concise and friendly.\"\n    )\n    return agent, []",
    "visibility": "private"
  }' | jq

Response:

json
{
  "data": {
    "agentId": "agent-abc123...",
    "agentName": "my-first-agent",
    "slug": "yourname/my-first-agent",
    "status": "active"
  }
}

Step 2: Chat with Your Agent

bash
curl -s -X POST https://stream.api.universalapi.co/agent/agent-abc123/chat \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Hello! What can you help me with?"}'

Response (streamed):

Hello! I'm a helpful assistant. I can help you with:

- Answering questions on a wide range of topics
- Explaining concepts clearly
- Helping with writing and editing
- Problem-solving and brainstorming

What would you like to know?

__META__{"conversationId":"conv-xxx","agentId":"agent-abc123","bedrockProvider":"platform"}
__METRICS__{"totalCycles":1,"totalTokens":250,"toolsUsed":[]}

Step 3: Continue the Conversation

Use the conversationId from the response to maintain context:

bash
curl -s -X POST https://stream.api.universalapi.co/agent/agent-abc123/chat \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Tell me about the Strands SDK",
    "conversationId": "conv-xxx"
  }'

The agent remembers the full conversation history.

Step 4: Add Tools (Optional)

Create an agent that can use MCP server tools:

bash
curl -s -X POST https://api.universalapi.co/agent/create \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "agentName": "search-agent",
    "description": "An agent that can search the web",
    "sourceCode": "import os\nfrom strands import Agent\nfrom strands.models.bedrock import BedrockModel\nfrom strands.tools.mcp import MCPClient\nfrom strands.tools.mcp.mcp_client import StreamableHTTPTransport\n\ndef create_agent():\n    model = BedrockModel(\n        model_id=\"us.anthropic.claude-sonnet-4-20250514-v1:0\",\n        region_name=\"us-east-1\"\n    )\n    transport = StreamableHTTPTransport(\n        url=\"https://mcp.api.universalapi.co/mcp/mcp-f1d167e0-d834-4a8e-a4e0-c40b3a498b16\",\n        headers={\"Authorization\": f\"Bearer {os.environ.get('"'"'UNIVERSALAPI_BEARER_TOKEN'"'"', '"'"''"'"')}\"}\n    )\n    mcp_client = MCPClient(transport=transport)\n    agent = Agent(\n        model=model,\n        system_prompt=\"You are a helpful research assistant. Use your tools to search for information.\",\n        tools=[mcp_client]\n    )\n    return agent, [mcp_client]",
    "visibility": "private"
  }' | jq

What's Next?

Universal API - The agentic entry point to the universe of APIs