-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy path01-basic-agent.ts
More file actions
34 lines (29 loc) · 889 Bytes
/
Copy path01-basic-agent.ts
File metadata and controls
34 lines (29 loc) · 889 Bytes
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
/**
* 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
* - CONDUCTOR_AGENT_LLM_MODEL set (optional)
*/
import { Agent, AgentRuntime } from '@io-orkes/conductor-javascript/agents';
import { llmModel } from './settings';
export const agent = new Agent({
name: 'greeter',
model: llmModel,
instructions: 'You are a friendly assistant. Keep responses brief.',
});
export const prompt = 'Say hello and tell me a fun fact about Python.';
async function main() {
const runtime = new AgentRuntime();
try {
const result = await runtime.run(agent, prompt);
result.printResult();
} finally {
await runtime.shutdown();
}
}
main().catch(console.error);