Skip to content

feat: context compilation tests, auth module, multi-agent example#4

Merged
zeroasterisk merged 2 commits intomainfrom
feat/context-auth-multiagent-sample
Mar 9, 2026
Merged

feat: context compilation tests, auth module, multi-agent example#4
zeroasterisk merged 2 commits intomainfrom
feat/context-auth-multiagent-sample

Conversation

@zeroasterisk
Copy link
Copy Markdown
Owner

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:

  • 17 tests covering template variable substitution, global+agent instruction merging, output_key state storage, multi-agent transfer instructions, sequential agent state passing, empty instruction handling, and request building
  • Fixed bug: {: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 Connect
  • ADK.Auth.CredentialStore — behaviour for pluggable backends
  • ADK.Auth.InMemoryStore — Agent-based in-memory store
  • ADK.Auth.Config — tool auth requirements
  • Wired into ToolContext.request_credential/2
  • Added auth_config field to FunctionTool
  • 13 tests covering all types, store CRUD, and ToolContext integration

3. Multi-Agent Example

  • examples/multi_agent/ — complete runnable Mix project
  • Router agent delegates to weather and math specialists via transfer_to_agent
  • Multi-turn conversation support
  • 8 tests + README with architecture and usage

Test Results

  • mix test: 245 tests, 0 failures (main project)
  • mix test (example): 8 tests, 0 failures

Zaf 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
@zeroasterisk zeroasterisk merged commit fab18df into main Mar 9, 2026
0 of 4 checks passed
@zeroasterisk zeroasterisk deleted the feat/context-auth-multiagent-sample branch March 18, 2026 01:58
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.

1 participant