Skip to content

maceip/agent-code-execution-demos

Repository files navigation

Agent Framework Code Execution Demos

Collection of code execution agents demonstrating different AI agent frameworks with OpenTelemetry tracing.

Frameworks Included

Framework Agent Description
LangGraph langgraph_code_agent.py Graph-based code generation with retry logic
OpenAI openai_agents_code.py Function calling with code execution
AutoGen autogen_code_agent.py Multi-agent conversation for coding tasks
CrewAI crewai_code_agent.py Role-based crew for code development

Features

  • Code Execution: All agents can write and execute Python code
  • OpenTelemetry: Full OTEL tracing to Jaeger/OTLP collectors
  • Error Recovery: Automatic retry and error fixing
  • Multiple Tasks: Each agent demonstrates various coding challenges

Quick Start

1. Start OTEL Collector

cd otel-collector
docker compose up -d

2. Set Environment Variables

export OPENAI_API_KEY=your_key
export OTEL_EXPORTER_OTLP_ENDPOINT=localhost:4317

3. Install Dependencies

pip install langgraph langchain langchain-openai opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp
pip install crewai crewai-tools
pip install autogen-agentchat autogen-ext[openai]

4. Run Agents

# LangGraph
python langgraph_code_agent.py

# OpenAI Function Calling
python openai_agents_code.py

# AutoGen Multi-Agent
python autogen_code_agent.py

5. View Traces

Open Jaeger UI at http://localhost:16686

Trace Services

  • langgraph-code-agent
  • openai-agents-code
  • autogen-code-agent
  • crewai-code-agent

Use with ShadowMap

Export traces for ShadowMap analysis:

curl "http://localhost:16686/api/traces?service=langgraph-code-agent&limit=10" > traces.json

License

MIT

About

Code execution agents demonstrating LangGraph, OpenAI, AutoGen, CrewAI with OpenTelemetry

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages