-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Add Streaming and Human-in-the-Loop (HITL) Support to CMR Agents #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sanzog03
wants to merge
52
commits into
develop
Choose a base branch
from
enhance/refactor-streaming_support_with_hil
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
…ream data types in _astream
- Use the final text not delta - ALso bugfix tool output issue
- Fix token accumulation problem and output for free form response - IMprove tool calling output using "tool_output" stream event - Finalize CMRCareAgent as orchestrator
- Avoid emitting the completedevent until pipeline is complete - This is to make sure that search agent cmpletiion event data won't be validated with CMRCareAgent.output_schema
- Instead of yielding completed event immeidately, just store final output - Also bugfix token batch size param mismatch to _astream
- The orcehstrator itself carries the message tracking and just forwrads accordingly to the sub agent depending on search agent or output agent - The output agent is stateless
- The output forammter is stateless no matter what
- Convert akd-core compatible message list (compleition format) to openai response format for agents sdk - Properly flush and track tool calls in message history
- Already handled inside memory session
- Apparentl, hostedmcptool doesn't have 2 separate evnets. it's a single event iwth both intput and output
- Add `akd_ext._types` module to intoruduce custom types for easy import - validate `OpenAIBaseAgentConfig.tools` with either openai tool or akd tool
- Basically Any already encompasses everything
- Also add docs/specs/ hitl document
…com:NASA-IMPACT/akd-ext into enhance/refactor-streaming_support_with_hil
- Also improve the CARE prompt by adding extra information about toolt
… followup questions
…le in config tool list
- Now latest akd-core develop branch has incorpoarted it iwthin baseagentconfig - The injection happens beofre any ield-level validation
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.
Summary
This PR enhances the OpenAIBaseAgent (and CMRCareAgent) to support full streaming capabilities, including token streaming, reasoning events, and tool execution feedback. Additionally, it introduces Human-in-the-Loop (HITL) support, allowing agents to pause execution for user clarification and seamlessly resume with new context.
What it does
HumanTool. Execution halts and emits aHumanInputRequiredEventthat includes currentRunContext. It resumes when the user's response is sent along with previousRunContextin a new agent run.StreamEventtypes (StreamingTokenEvent,ThinkingEvent,ToolCallingEvent).How it does
Runner.run_streamedfrom the OpenAI SDK to process events.response.output_text.deltatoStreamingTokenEvent.reasoningcontent toThinkingEvent.ask_humantool calls to triggerHumanInputRequiredEvent.HumanResponseinto conversation history upon resumption viaRunContext._search_agentand stateless_formatter_agent.Files changed
CONTRIBUTING.md— Agent configuration guidelines update.Testing
To verify streaming and HITL functionality: