CrewAI + Govyn — Govern Your CrewAI Agents

Running CrewAI crews with Anthropic's Claude means multiple agents making concurrent API calls with premium pricing. Without governance, a crew of five agents can exhaust your monthly budget in a single afternoon — and you have no visibility into which agent is responsible.

How it works

CrewAI
Your agents
HTTPS
Govyn Proxy
Policy · Budget · Logs
API
Anthropic API
LLM provider

Step-by-step setup

1

Start the Govyn proxy

bash
npx govyn start --config govyn.yaml
2

Configure CrewAI agents with Govyn

python
from crewai import Agent, Crew, Task
from langchain_anthropic import ChatAnthropic

llm = ChatAnthropic(
    model="claude-sonnet-4-20250514",
    anthropic_api_url="http://localhost:4111",
    anthropic_api_key="gvn_agent_crew_analyst"
)

analyst = Agent(
    role="Data Analyst",
    goal="Analyze financial reports",
    llm=llm
)
3

Run your crew

python
task = Task(
    description="Analyze Q4 earnings reports",
    agent=analyst
)

crew = Crew(agents=[analyst], tasks=[task])
result = crew.kickoff()

Example policy

Define governance rules for your CrewAI agents in a simple YAML file.

govyn.yaml
agents:
  crew_analyst:
    budget:
      daily: $8.00
      monthly: $150.00
    models:
      allow: [claude-sonnet-4-20250514, claude-haiku-4-5-20251001]
    context:
      max_input_tokens: 30000
    rate_limit:
      requests_per_minute: 15
  crew_summarizer:
    budget:
      daily: $3.00
    models:
      allow: [claude-haiku-4-5-20251001]

Why use Govyn with CrewAI?

Per-agent budgets across your entire crew
Restrict expensive Claude models by agent role
Input token limits for long-context control
Concurrent request management
Full multi-agent conversation replay
Works with Claude tool-use in CrewAI

Get started in 5 minutes

Add governance to your CrewAI agents with a single config change. No code rewrites.

Read the docs

Frequently asked questions

Does Govyn work with CrewAI's hierarchical crew structure?
Yes. Govyn is transparent at the HTTP level — it works with flat, sequential, and hierarchical CrewAI crew structures. Each agent's API calls pass through Govyn regardless of the orchestration pattern.
Can I limit context window usage for cost control?
Yes. You can set max_input_tokens per agent to prevent long-context Claude calls. This is especially useful for CrewAI agents that might accumulate large context through multi-step conversations.
How do I monitor a running crew's spend in real time?
Govyn tracks spend per agent key in real time. You can query the proxy's status endpoint or check the dashboard to see cumulative spend for each crew member while the crew is running.

Related integrations

Explore more