forked from conductor-oss/python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01_basic_agent.py
More file actions
36 lines (28 loc) · 1.02 KB
/
Copy path01_basic_agent.py
File metadata and controls
36 lines (28 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""Basic Agent — 5-line hello world.
Demonstrates the simplest possible agent: define an agent, call
``runtime.run()``, and print the result.
Requirements:
- Conductor server with LLM support
- CONDUCTOR_SERVER_URL=http://localhost:8080/api in .env or environment
- CONDUCTOR_AGENT_LLM_MODEL set in .env or environment (optional)
"""
from conductor.ai.agents import Agent, AgentRuntime
from settings import settings
agent = Agent(
name="greeter",
model=settings.llm_model,
instructions="You are a friendly assistant. Keep responses brief.",
)
prompt = "Say hello and tell me a fun fact about Python."
if __name__ == "__main__":
with AgentRuntime() as runtime:
result = runtime.run(agent, prompt)
result.print_result()
# Production pattern:
# 1. Deploy once during CI/CD:
# runtime.deploy(agent)
# CLI alternative:
# runtime.deploy(agent) from a release script
#
# 2. In a separate long-lived worker process:
# runtime.serve(agent)