feat: context compilation tests, auth module, multi-agent example#4
Merged
zeroasterisk merged 2 commits intomainfrom Mar 9, 2026
Merged
feat: context compilation tests, auth module, multi-agent example#4zeroasterisk merged 2 commits intomainfrom
zeroasterisk merged 2 commits intomainfrom
Conversation
added 2 commits
March 9, 2026 00:13
…t handoffs - Add ADK.Tool.TransferToAgent module that generates transfer tools for sub-agents - Auto-inject transfer_to_agent_<name> tools when LlmAgent has sub_agents - Handle transfer signals in LlmAgent.do_run: detect transfer, find target sub-agent, fork context, and run the sub-agent - Add transfer instructions to system prompt when sub-agents are configured - Add global_instruction support and state variable substitution in instructions - Fix rescue-in-anonymous-function syntax error in substitute_state_variables - 6 new tests for TransferToAgent, all passing
## Context Compilation (#79)
- Add global_instruction field to LlmAgent struct
- Add compile_instruction() with template variable substitution via {key} patterns
- Add transfer instruction generation for sub-agents
- Fix transfer_to_agent detection when wrapped by FunctionTool
- 17 context compilation tests covering:
- Template variable substitution in instructions
- Global + agent instruction merging
- Output key state storage (atom and string keys)
- Multi-agent context with transfer instructions
- State passed through sequential agents (2 and 3 stage pipelines)
- Empty/missing instruction handling
- Request building with tools and transfer tools
## Auth Module (#81)
- ADK.Auth.Credential — struct for API key, OAuth2, service account,
HTTP bearer, OpenID Connect credential types
- ADK.Auth.CredentialStore — behaviour for pluggable backends
- ADK.Auth.InMemoryStore — in-memory Agent-based store for dev/test
- ADK.Auth.Config — tool auth requirements declaration
- Wire into ToolContext with request_credential/2
- Add auth_config field to FunctionTool
- 13 auth tests covering all credential types, store CRUD, and
ToolContext integration
## Multi-Agent Example
- examples/multi_agent/ — complete runnable Mix project
- Router agent with weather and math specialist sub-agents
- Demonstrates transfer_to_agent in action
- Multi-turn conversation support
- 8 tests covering agent construction, transfer, and multi-turn
- README with architecture diagram and usage examples
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.
Summary
Three features in one PR:
1. Context Compilation Tests (#79) — P1
Deep review and testing of how the LLM context is compiled, mirroring Python ADK's
BaseLlmFlow:{:ok, {:transfer_to_agent, name}}wasn't detected as transfer (FunctionTool wraps return values)2. Auth Module (#81) — P1
Full auth module design and implementation:
ADK.Auth.Credential— struct for API key, OAuth2, service account, HTTP bearer, OpenID ConnectADK.Auth.CredentialStore— behaviour for pluggable backendsADK.Auth.InMemoryStore— Agent-based in-memory storeADK.Auth.Config— tool auth requirementsToolContext.request_credential/2auth_configfield toFunctionTool3. Multi-Agent Example
examples/multi_agent/— complete runnable Mix projecttransfer_to_agentTest Results
mix test: 245 tests, 0 failures (main project)mix test(example): 8 tests, 0 failures