- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.8k
Description
Please read this first
Describe the bug
I have been using the Open AI Agents SDK (litellm version) for integrating agents into my app.
Now while any chat completion+ it's cost+tokens (via the agents) does show up in the litellm UI, I am not able to add any extra_body to the request which will help me control Metadata or Sessions or Tags.
I have tried passing it in the Run Config in the Model Settings Extra Body Param by referring to https://docs.litellm.ai/docs/proxy/cost_tracking#client-side-spend-tag and https://docs.litellm.ai/docs/proxy/ui_logs_sessions.
But nothing shows up on the Litellm UI dashboard.
Note: Now I am not sure if this an issue from open ai's sdk or if litellm currently does not support adding metadata (and others) to the oai agents sdk or if I am passing in params incorrectly.
I'm tried a lot of params but still not work:
            # Use standard LitellmModel with metadata configured via ModelSettings
            agent_config["model"] = LitellmModel(
                model=f'litellm_proxy/{self.litellm_proxy_model}',
                api_key=self.litellm_master_key,
                base_url=self.litellm_proxy_url
            )
            # Configure base ModelSettings with static metadata
            # Request-specific metadata (conversation_id, user_id) will be added at runtime
            base_metadata = {
                "service": "pfa-ai-services",
                "environment": os.getenv("ENV", "development"),
                "agent_name": name,
                "model_type": self.litellm_proxy_model,
                "trace_user_id": "user-id-123",
                "generation_id": "gen-id-456",
                "trace_id": "trace-id-789"
            }
            agent_config["model_settings"] = ModelSettings(
                parallel_tool_calls=True,
                max_tokens=8000,
                metadata=base_metadata,
                extra_args={
                    "metadata": {
                        "trace_user_id": "user-id-123",
                        "generation_id": "gen-id-456",
                        "trace_id": "trace-id-789"
                    }
                extra_body=
                    "metadata": {
                        "trace_user_id": "user-id-123",
                        "generation_id": "gen-id-456",
                        "trace_id": "trace-id-789"
                    }
            )
Debug information
- Agents SDK version: 0.2.11
- Python version: 3.11