feat: agent default thread and final turn message - #71
Merged
Conversation
An instance had no record of the thread it was created to serve, so the text an agent CLI produces at the end of a turn had nowhere to go. agent_instances gains default_thread_id, nullable because an instance whose class asked for no inference legitimately has none -- its untargeted sends are refused rather than guessed at. Agents gain the two policies that decide the field: default_thread, which says what to infer at creation, and final_message, which says whether the final text is a deliverable at all. CreateInstance is where the policy runs. Both creation paths funnel through it and it already holds the class, so Threads reports the circumstances in a context object and this decides what they mean. A caller that names a thread outright bypasses the policy, which governs only what the platform infers when nobody said; SetInstanceDefaultThread moves it afterwards on the same reasoning. The defaults preserve today's behaviour: origin is the only inference that composes for delegation, and discard keeps agents that already send explicitly from posting everything twice.
This was referenced Aug 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agents half of 2026-08-01-agent-default-thread. Needs api#168 (merged).
agent_instances.default_thread_id— nullable, because an instance whose class asked for no inference legitimately has none. Its untargeted sends get refused rather than guessed at. No foreign key: threads are another service's data.agents.default_thread/agents.final_message— both describe how an agent is written, not any one instance, so they sit on the class. Defaultsoriginanddiscardpreserve today's behaviour.CreateInstanceapplies the policy. Both creation paths funnel through it and it already holds the class definition, so Threads reports circumstances incontextand this decides what they mean. An explicitdefault_thread_idbypasses the policy — the policy governs only what the platform infers when nobody said.SetInstanceDefaultThread, guarded bycan_manage.Still to come in other repos: Threads passing
context.thread_idon class-on-add and resolving an omittedthread_id, and agynd posting the final text.