feat(runtime): let the Agentkitfile choose Chat Completions or Responses
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- backend, build-system
Direzione di ricerca
Start after #36 merges, then trace the model settings through pkg/agentkit/config/specs.go, pkg/agentkit/effective, and pkg/agentkit/abi to see how agent.yaml is built. Read the configuration and adapter code in runtimes/common/agentkit_serve_common/config.py and adapter_support.py, then check the docs named in the issue. Done means the optional API choice is validated, baked into the YAML without changing existing bytes when omitted, and covered by the specified tests.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Start after #36 merges. #36 adds the
AGENTKIT_MODEL_APIenvironment variable that this issue builds on.
Problem
An AgentKit agent talks to its model through one of two OpenAI-style APIs:
- Chat Completions (
POST /v1/chat/completions) is the older API and AgentKit's default. - Responses (
POST /v1/responses) is the newer API. Some new reasoning models only allow tool calls through Responses. #32 shows a model where every tool call over Chat Completions fails.
#36 lets you pick the API with an environment variable: AGENTKIT_MODEL_API=chat_completions, responses, or auto. That works with docker run -e ..., but not when Orka runs the agent.
Under Orka, a program called the supervisor starts agentkit-serve --protocol acp as a child process. It gives that process only the environment variables it chooses itself (see BuildChildEnvironment in Orka's internal/acp/runtime_env.go). Variables set in the image or on the Pod never reach AgentKit. So under Orka, AgentKit always uses Chat Completions, and agents on Responses-only models can't use tools.
What
Add an optional model.api field to the Agentkitfile and to the baked /agent/agent.yaml:
model:
provider: openai-compatible
baseURL: https://api.openai.com/v1
name: gpt-6-luna
apiKeyEnv: OPENAI_API_KEY
api: responses # chat_completions (default), responses, or auto
It accepts the same three values as AGENTKIT_MODEL_API. When the field is left out, nothing changes.
Out of scope:
- New model providers or API types.
- Changing how
autodecides which API to use. - The Orka side. Orka's model proxy must also let AgentKit send Responses requests. That is tracked in orka-agents/orka#879.
Why
agent.yaml is already the file Orka trusts. When Orka runs AgentKit, it passes a SHA-256 digest of the exact agent.yaml bytes, and AgentKit refuses to start if the file doesn't match (runtimes/common/agentkit_serve_common/acp.py, around lines 353 to 374). Putting the choice in agent.yaml means:
- It works under Orka with no new Orka setting.
- It is locked in automatically. Changing the API means building a new image with a new digest, which Orka already checks.
- The choice lives with the rest of the agent's settings, in one file.
How
- Agentkitfile. Add an
APIfield (yaml:"api,omitempty") to the model settings inpkg/agentkit/config/specs.go, next toProvider(around line 24). Accept onlychat_completions,responsesandauto. Any other value fails the build with a message that lists the allowed values. - Baked
agent.yaml. Carry the field throughpkg/agentkit/effectiveand write it inpkg/agentkit/abi. Leave it out when it is empty, soagent.yamlfor existing Agentkitfiles stays byte-for-byte the same and their digests don't change. - Python reader. Read
model.apiinruntimes/common/agentkit_serve_common/config.pyand check it against the same three values. - Choosing the API. In
runtimes/common/agentkit_serve_common/adapter_support.py, where #36 readsAGENTKIT_MODEL_API(around line 61 on the #36 branch), use this order: the environment variable if it is set, thenmodel.api, thenchat_completions. Checking the environment variable first keeps existingdocker run -e AGENTKIT_MODEL_API=...setups working. Under Orka the variable is never set, soagent.yamldecides. - Docs. Describe the field in
docs/agentkitfile.mdanddocs/agent-abi.md. Indocs/orka.md, note that under Orka this field is the only way to choose the API.
Done when
- An Agentkitfile with
api: responsesbuilds, and the image's/agent/agent.yamlcontainsapi: responses. - An Agentkitfile without
apiproduces exactly the sameagent.yamlbytes as before. - An invalid value fails the build and the message lists the allowed values.
- A Python test shows each adapter uses Responses when
agent.yamlsaysresponsesand the environment variable is not set, and that the environment variable wins when both are set. -
uv run --directory runtimes/common --extra dev pytest -q,go test ./...andmake lintpass.
- Lingua principale
- Python
- Stelle
- 7
- Fork
- 5
- Merge medio
- 3h 39m
- PR unite (30g)
- 1
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di orka-agents/agentkit
-
fix(pydantic-ai): CI fails with newest pydantic-ai (unexpected 'history' argument)Forse già presa @gambtho l’ha presa 30 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
orka-agents/agentkit#77 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
orka-agents/agentkit#76 · 3 commenti ·
-
area/build area/orka area/runtime blocked enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
orka-agents/agentkit#69 ·
-
area/build enhancement testing
Difficoltà 5/5 Più di una settimana Idoneità per principianti 42/100
orka-agents/agentkit#65 ·
-
area/build enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
orka-agents/agentkit#64 ·
Tutte le issue di orka-agents/agentkit
Issue simili
-
【文档错误】创建镜像空间步骤中的截图标注与文字描述不一致Apertaenhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
DaoCloud/DaoCloud-docs#7839 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
sav-oss-org/ptusa_main#1610 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
bug status/accepted type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
microsoft/apm#4925 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
sagemathinc/sagebrush#1701 ·
I maintainer di solito rispondono entro 1 giorno