-
Notifications
You must be signed in to change notification settings - Fork 1
Examples
Jason Upchurch edited this page Jan 23, 2026
·
1 revision
GENESIS includes several example applications demonstrating different patterns and capabilities.
examples/
├── HelloWorld/ # Minimal agent + service
├── MultiAgent/ # Agent-to-agent communication
├── GraphInterface/ # Chat with visualization
├── ExampleInterface/ # Interface patterns
└── StandaloneGraphViewer/ # Topology visualization
The simplest starting point - a basic agent and calculator service.
# Terminal 1: Start the service
cd examples/HelloWorld
python hello_world_service.py
# Terminal 2: Start the agent
python hello_world_agent.py| File | Description |
|---|---|
hello_world_agent.py |
Simple OpenAI agent |
hello_world_service.py |
Calculator service with add/multiply |
mcp_agent.py |
Agent with MCP support |
Demonstrates agent-to-agent delegation with a PersonalAssistant that routes to specialist agents.
User → PersonalAssistant → WeatherAgent → Weather API
→ FinanceAgent → Stock API
# Terminal 1: Weather Agent
python agents/weather_agent.py
# Terminal 2: Personal Assistant
python agents/personal_assistant.py
# Terminal 3: Interface
python interfaces/interactive_cli.py- Agent Discovery: PersonalAssistant discovers WeatherAgent automatically
- Agent-as-Tool: WeatherAgent appears as a tool to the LLM
- Delegation: "What's the weather?" routes to WeatherAgent
Chat interface with real-time topology visualization.
- Web-based chat UI
- Live graph showing agents, services, connections
- Request tracing visualization
python graph_interface.py
# Open http://localhost:5000 in browserfrom genesis_lib.openai_genesis_agent import OpenAIGenesisAgent
class SimpleAgent(OpenAIGenesisAgent):
def __init__(self):
super().__init__(
model_name="gpt-4o",
agent_name="SimpleAgent"
)
async def main():
agent = SimpleAgent()
response = await agent.process_message("Hello!")
print(response)
await agent.close()
asyncio.run(main())from genesis_lib.monitored_service import MonitoredService
from genesis_lib.decorators import genesis_function
class MathService(MonitoredService):
def __init__(self):
super().__init__("MathService", capabilities=["math"])
self._advertise_functions()
@genesis_function()
async def add(self, a: float, b: float) -> Dict[str, Any]:
"""Add two numbers."""
return {"result": a + b}
@genesis_function()
async def multiply(self, a: float, b: float) -> Dict[str, Any]:
"""Multiply two numbers."""
return {"result": a * b}
@genesis_function()
async def factorial(self, n: int) -> Dict[str, Any]:
"""Calculate factorial of n."""
result = 1
for i in range(2, n + 1):
result *= i
return {"result": result}
asyncio.run(MathService().run())from genesis_lib.openai_genesis_agent import OpenAIGenesisAgent
from genesis_lib.decorators import genesis_tool
from datetime import datetime
class ToolAgent(OpenAIGenesisAgent):
def __init__(self):
super().__init__(model_name="gpt-4o", agent_name="ToolAgent")
@genesis_tool
async def get_current_time(self) -> str:
"""Get the current date and time."""
return datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@genesis_tool
async def calculate(self, expression: str) -> str:
"""Evaluate a math expression safely."""
return str(eval(expression)) # Use safer eval in productionclass OrchestratorAgent(OpenAIGenesisAgent):
def __init__(self):
super().__init__(
model_name="gpt-4o",
agent_name="Orchestrator",
enable_agent_communication=True # Enable agent discovery
)Run the test suite to verify examples work:
cd tests
./run_all_tests.sh- Getting-Started - Installation and setup
- API-Reference - Detailed API docs
- Architecture - System design