Skip to content

feat: send codedagentsplayground agenthub-config for coded agents (llamaindex, openai-agents) - #372

Draft
al3xanndru wants to merge 1 commit into
mainfrom
feat/coded-agents-playground-agenthub-config
Draft

feat: send codedagentsplayground agenthub-config for coded agents (llamaindex, openai-agents)#372
al3xanndru wants to merge 1 commit into
mainfrom
feat/coded-agents-playground-agenthub-config

Conversation

@al3xanndru

Copy link
Copy Markdown

What

Makes LlamaIndex and OpenAI-Agents coded agents meter their design-time LLM calls as CodedAgents.Playground (drawing that pool) and deployed runs as AgentHub.LLM — matching what the LangGraph path already does. Both send x-uipath-agenthub-config via the shared resolve_coded_agenthub_config() helper from uipath.platform (design-time → "codedagentsplayground", deployed → None).

Neither package depends on uipath-llm-client, so they don't inherit the LangGraph change — each builds its own gateway headers. This wires the shared helper into those header paths.

Changes

uipath-openai-agents (chat/openai.py)

  • UiPathChatOpenAI defaults agenthub_config via the helper when the caller doesn't pass one; the existing _build_headers() already emits the header. Explicit agenthub_config still wins.

uipath-llamaindex (all three LLM providers)

  • llms/_openai.py, llms/bedrock.py, llms/vertex.py: inject x-uipath-agenthub-config into the request headers.

Both

  • Add uipath-platform>=0.2.18 (the release adding the helper).
  • Tests (openai-agents _build_headers; llamaindex _openai default headers) covering design-time → marker present, deployed → omitted.
  • Version bumps: uipath-openai-agents 0.1.0→0.1.1, uipath-llamaindex 0.6.0→0.6.1.

⚠️ Stacked on an unpublished dependency

Requires uipath-platform 0.2.18, introduced by uipath-python #1860. Until that publishes, uv sync can't resolve the pin, so CI is red and I couldn't run the suites locally — validate early via the repo's test-core-dev-version label against a dev build. Merge #1860 first.

Notes

  • ruff check + ruff format clean on all changed files.
  • Bedrock/Vertex inject through their request transports (same helper); the shared helper itself is unit-tested in #1860.
  • The now-archived standalone uipath-openai-agents repo is not touched — this targets the active monorepo home.

Related: AgentHubService #1618 · gitops #551167 · uipath-llm-client #125 · langchain #1035

🤖 Generated with Claude Code

Make LlamaIndex and OpenAI-Agents coded agents meter their design-time LLM
calls as CodedAgents.Playground, using the shared resolve_coded_agenthub_config()
helper from uipath.platform (design-time -> "codedagentsplayground", deployed -> None).

- uipath-openai-agents: UiPathChatOpenAI defaults agenthub_config via the helper
  when the caller does not pass one (existing _build_headers already emits it).
- uipath-llamaindex: inject the x-uipath-agenthub-config header into the OpenAI,
  Bedrock, and Vertex LLM clients' request headers.

Adds uipath-platform>=0.2.18 to both packages (the release that adds the helper)
and tests. Bumps uipath-openai-agents 0.1.0 -> 0.1.1 and uipath-llamaindex
0.6.0 -> 0.6.1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 13, 2026 12:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns LlamaIndex and OpenAI-Agents coded-agent integrations with the LangGraph metering behavior by defaulting design-time LLM calls to the CodedAgents.Playground pool (via codedagentsplayground) and omitting the marker in deployed runs (falling back to AgentHub.LLM). This is done by wiring the shared resolve_coded_agenthub_config() helper into each package’s gateway header construction.

Changes:

  • uipath-openai-agents: default agenthub_config via resolve_coded_agenthub_config() when not explicitly provided, relying on existing header emission.
  • uipath-llamaindex: inject x-uipath-agenthub-config (via HEADER_AGENTHUB_CONFIG) into OpenAI/Bedrock/Vertex gateway request headers.
  • Add uipath-platform>=0.2.18,<0.3.0, bump package versions, and add tests for design-time vs deployed behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/uipath-openai-agents/src/uipath_openai_agents/chat/openai.py Defaults agenthub_config using resolve_coded_agenthub_config() so header behavior matches metering requirements.
packages/uipath-openai-agents/tests/test_chat_openai.py Adds tests validating config header presence/absence based on design-time vs deployed environment.
packages/uipath-openai-agents/pyproject.toml Adds uipath-platform dependency and bumps version to 0.1.1.
packages/uipath-llamaindex/src/uipath_llamaindex/llms/_openai.py Adds agenthub config header into OpenAI default headers via shared helper.
packages/uipath-llamaindex/src/uipath_llamaindex/llms/bedrock.py Injects agenthub config header into Bedrock gateway request modification path.
packages/uipath-llamaindex/src/uipath_llamaindex/llms/vertex.py Injects agenthub config header into Vertex gateway request rewrite transport.
packages/uipath-llamaindex/tests/llms/test_openai.py Adds tests validating default headers include/omit agenthub config in design-time vs deployed.
packages/uipath-llamaindex/pyproject.toml Adds uipath-platform dependency and bumps version to 0.6.1.
Suppressed comments (2)

packages/uipath-openai-agents/tests/test_chat_openai.py:96

  • UiPathConfig.reset() cleanup is not guaranteed if the assertion fails; that can leak global config state into later tests. Wrap the test body in a try/finally so the reset always runs.
    monkeypatch.setenv("UIPATH_JOB_KEY", "deployed-job")
    monkeypatch.chdir(tmp_path)
    UiPathConfig.reset()

    client = UiPathChatOpenAI(token="t", org_id="org", tenant_id="tn")
    assert "X-UiPath-AgentHub-Config" not in client._build_headers()
    UiPathConfig.reset()

packages/uipath-llamaindex/tests/llms/test_openai.py:100

  • UiPathConfig.reset() cleanup is not guaranteed if the assertion fails; that can leak global config state into later tests. Wrap the test body in a try/finally so the reset always runs.
    monkeypatch.setenv("UIPATH_URL", "https://cloud.uipath.com/org/tenant/")
    monkeypatch.setenv("UIPATH_ACCESS_TOKEN", "token")
    monkeypatch.setenv("UIPATH_JOB_KEY", "deployed-job")
    monkeypatch.delenv("UIPATH_PROJECT_ID", raising=False)
    monkeypatch.chdir(tmp_path)
    UiPathConfig.reset()


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +73 to +81
monkeypatch.delenv("UIPATH_JOB_KEY", raising=False)
monkeypatch.chdir(tmp_path)
UiPathConfig.reset()

client = UiPathChatOpenAI(token="t", org_id="org", tenant_id="tn")
assert (
client._build_headers()["X-UiPath-AgentHub-Config"] == "codedagentsplayground"
)
UiPathConfig.reset()
Comment on lines +77 to +88
monkeypatch.setenv("UIPATH_URL", "https://cloud.uipath.com/org/tenant/")
monkeypatch.setenv("UIPATH_ACCESS_TOKEN", "token")
monkeypatch.delenv("UIPATH_JOB_KEY", raising=False)
monkeypatch.delenv("UIPATH_PROJECT_ID", raising=False)
monkeypatch.chdir(tmp_path)
UiPathConfig.reset()

llm = UiPathOpenAI(model=OpenAIModel.GPT_4O_2024_08_06)
assert (
llm.default_headers.get("x-uipath-agenthub-config") == "codedagentsplayground"
)
UiPathConfig.reset()
@al3xanndru
al3xanndru marked this pull request as draft August 13, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants