Multi-Agent

Serve multiple agents from a single runtime

Run multiple agents together from a single server.

The Agents

from reminix.runtime import Agent, serve

# First agent: Greeter
greeter = Agent("greeter")

@greeter.invoke
async def greet(input_data: dict) -> dict:
    name = input_data.get("name", "World")
    return {"output": f"Hello, {name}! Welcome to Reminix."}

@greeter.chat
async def greet_chat(messages: list) -> dict:
    return {
        "message": {
            "role": "assistant",
            "content": "Hello! I'm the greeter agent. How can I help?",
        }
    }

# Second agent: Calculator
calculator = Agent("calculator")

@calculator.invoke
async def calculate(input_data: dict) -> dict:
    a = input_data.get("a", 0)
    b = input_data.get("b", 0)
    operation = input_data.get("operation", "add")

    if operation == "add":
        result = a + b
    elif operation == "subtract":
        result = a - b
    elif operation == "multiply":
        result = a * b
    elif operation == "divide":
        result = a / b if b != 0 else "Error: Division by zero"
    else:
        result = f"Unknown operation: {operation}"

    return {"output": result}

if __name__ == "__main__":
    # Serve multiple agents together
    serve([greeter, calculator], port=8080)

Running

python agent.py

Testing

# Health check shows both agents
curl http://localhost:8080/health
# {"status": "healthy", "agents": ["greeter", "calculator"]}

# Greeter agent
curl -X POST http://localhost:8080/agent/greeter/invoke \
    -H "Content-Type: application/json" \
    -d '{"input": {"name": "World"}, "stream": false}'

# Calculator agent
curl -X POST http://localhost:8080/agent/calculator/invoke \
    -H "Content-Type: application/json" \
    -d '{"input": {"a": 5, "b": 3, "operation": "add"}, "stream": false}'

Agent Endpoints

Each agent gets its own endpoints:

EndpointDescription
GET /agent/greeter/healthGreeter capabilities
POST /agent/greeter/invokeInvoke greeter
POST /agent/greeter/chatChat with greeter
GET /agent/calculator/healthCalculator capabilities
POST /agent/calculator/invokeInvoke calculator

Agent Names

Agent names must be unique and contain only:

  • Lowercase letters (a-z)
  • Numbers (0-9)
  • Hyphens (-)
  • Underscores (_)
# Valid names
Agent("my-agent")
Agent("agent_v2")
Agent("chat123")

# Invalid names (will raise an error)
Agent("My Agent")  # spaces not allowed
Agent("Agent!")    # special characters not allowed

Next Steps

On this page