|
2 | 2 | # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ |
3 | 3 |
|
4 | 4 |
|
5 | | -"""Demonstrates running an OpenAI Agents workflow against the AgentHub endpoint.""" |
| 5 | +"""Demonstrates using OpenAI Agents SDK against the AgentHub endpoint.""" |
6 | 6 |
|
7 | 7 | import asyncio |
8 | | - |
9 | | -from agents import Agent, Runner, set_default_openai_client, trace |
10 | | - |
| 8 | +from agents import Agent, Runner, set_default_openai_client, set_tracing_disabled |
11 | 9 | from examples.agenthub import common |
12 | 10 |
|
13 | | -MODEL = "xai.grok-4-1-fast-reasoning" |
14 | | - |
15 | | -# Set the OCI OpenAI Client as the default client to use with OpenAI Agents |
16 | 11 | set_default_openai_client(common.build_agenthub_async_client()) |
17 | | - |
| 12 | +set_tracing_disabled(True) |
18 | 13 |
|
19 | 14 | async def main(): |
20 | | - agent = Agent(name="Assistant", instructions="You are a helpful assistant", model=MODEL) |
21 | | - # https://openai.github.io/openai-agents-python/models/#tracing-client-error-401 |
22 | | - with trace("Trace workflow"): |
23 | | - result = await Runner.run(agent, "Write a haiku about recursion in programming.") |
24 | | - print(result.final_output) |
25 | | - |
| 15 | + agent = Agent(name="Assistant", instructions="You are a helpful assistant", model="xai.grok-4-1-fast-reasoning") |
| 16 | + result = await Runner.run(agent, "Write a haiku about recursion in programming.") |
| 17 | + print(result.final_output) |
26 | 18 |
|
27 | 19 | if __name__ == "__main__": |
28 | 20 | asyncio.run(main()) |
0 commit comments