Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
Created December 7, 2024 17:07
Show Gist options
  • Save amosgyamfi/4b7238afd843a404311f66ab4c0b54d4 to your computer and use it in GitHub Desktop.
Save amosgyamfi/4b7238afd843a404311f66ab4c0b54d4 to your computer and use it in GitHub Desktop.
from swarm import Swarm, Agent
client = Swarm()
mini_model = "gpt-4o-mini"
# Coordinator function
def transfer_to_agent_b():
return agent_b
# Agent A
agent_a = Agent(
name="Agent A",
instructions="You are a helpful assistant.",
functions=[transfer_to_agent_b],
)
# Agent B
agent_b = Agent(
name="Agent B",
model=mini_model,
instructions="You speak only in Finnish.",
)
response = client.run(
agent=agent_a,
messages=[{"role": "user", "content": "I want to talk to Agent B."}],
debug=False,
)
print(response.messages[-1]["content"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment