You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to uninstrument OpenAIAgents so my traces do not get sent to them. Their documentation indicates that this is enabled by default. I can disable it, but if I do, my traces get sent to Phoenix as ChatCompletions rather than Agent Workflows.
I disabled it by setting the env variable OPENAI_AGENTS_DISABLE_TRACING=1 but this changes how my traces get sent to Phoenix.
What did you expect to happen?
I would have expected my Agent Workflows to get sent to Phoenix the same way regardless of OpenAI's agent tracing being enabled.
How can we reproduce the bug?
I'm not sure how exactly you can reproduce this. Here is my code:
importosimportasynciofromdotenvimportload_dotenvfrompydanticimportBaseModelfromopenaiimportAsyncOpenAIfromagentsimport (
Agent,
Model,
ModelProvider,
OpenAIChatCompletionsModel,
RunConfig,
Runner,
InputGuardrail,
GuardrailFunctionOutput,
exceptionsasagent_exceptions
)
load_dotenv(".env")
# Get API Settings from .envAPI_KEY=os.getenv("OPENAI_API_KEY")
BASE_URL=os.getenv("BASE_URL")
MODEL_NAME=os.getenv("MODEL")
client=AsyncOpenAI(
base_url=BASE_URL,
api_key=API_KEY,
)
# configure the Phoenix tracerfromphoenix.otelimportregistertracer_provider=register(
project_name="agents",
endpoint="https://my_url.com/v1/traces",
auto_instrument=True,
batch=True
)
classHomeworkOutput(BaseModel):
is_homework: boolreasoning: strclassCustomModelProvider(ModelProvider):
defget_model(self, model_name: str|None) ->Model:
returnOpenAIChatCompletionsModel(model=model_nameorMODEL_NAME, openai_client=client)
asyncdefhomework_guardrail(ctx, agent, input_data):
result=awaitRunner.run(
starting_agent=guardrail_agent,
input=input_data,
context=ctx.context,
run_config=RunConfig(model_provider=CUSTOM_MODEL_PROVIDER),
)
final_output=result.final_output_as(HomeworkOutput)
returnGuardrailFunctionOutput(
output_info=final_output,
tripwire_triggered=final_output.is_homework,
)
CUSTOM_MODEL_PROVIDER=CustomModelProvider()
# Define your agentsguardrail_agent=Agent(
name="Guardrail check",
instructions="Check if the user is asking about homework.",
output_type=HomeworkOutput,
)
math_tutor_agent=Agent(
name="Math Tutor",
handoff_description="Specialist agent for math questions",
instructions="You provide help with math problems. Explain your reasoning at each step and include examples",
)
history_tutor_agent=Agent(
name="History Tutor",
handoff_description="Specialist agent for historical questions",
instructions="You provide assistance with historical queries. Explain important events and context clearly.",
)
triage_agent=Agent(
name="Triage Agent",
instructions="You determine which agent to use based on the user's homework question",
handoffs=[history_tutor_agent, math_tutor_agent],
# input_guardrails=[# InputGuardrail(guardrail_function=homework_guardrail),# ],
)
asyncdefmain():
result=awaitRunner.run(
starting_agent=triage_agent,
input="who was the first president of the united states?",
run_config=RunConfig(model_provider=CUSTOM_MODEL_PROVIDER),
)
print(result.final_output)
if__name__=="__main__":
try:
asyncio.run(main())
exceptagent_exceptions.InputGuardrailTripwireTriggered:
print("Guardrail InputGuardrail triggered tripwire")
This same code produces different results on the Phoenix dashboard if I either set or unset OPENAI_AGENTS_DISABLE_TRACING=1
Additional information
No response
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Where do you use Phoenix
Local (self-hosted)
What version of Phoenix are you using?
10.0.4
What operating system are you seeing the problem on?
MacOS
What version of Python are you running Phoenix with?
3.12.7
What version of Python or Node are you using instrumentation with?
3.12.7
What instrumentation are you using?
Python
What happened?
I am trying to uninstrument OpenAIAgents so my traces do not get sent to them. Their documentation indicates that this is enabled by default. I can disable it, but if I do, my traces get sent to Phoenix as ChatCompletions rather than Agent Workflows.
I disabled it by setting the env variable
OPENAI_AGENTS_DISABLE_TRACING=1
but this changes how my traces get sent to Phoenix.What did you expect to happen?
I would have expected my Agent Workflows to get sent to Phoenix the same way regardless of OpenAI's agent tracing being enabled.
How can we reproduce the bug?
I'm not sure how exactly you can reproduce this. Here is my code:
This same code produces different results on the Phoenix dashboard if I either set or unset
OPENAI_AGENTS_DISABLE_TRACING=1
Additional information
No response
The text was updated successfully, but these errors were encountered: