Skip to content

feat(agent): provider-neutral LlmProvider trait + types (#8) - #49

Merged
ammar-s847 merged 1 commit into
mainfrom
agent/loop-provider
May 27, 2026
Merged

feat(agent): provider-neutral LlmProvider trait + types (#8)#49
ammar-s847 merged 1 commit into
mainfrom
agent/loop-provider

Conversation

@ammar-s847

Copy link
Copy Markdown
Contributor

Implements #8 — the stable seam between Stream A (providers) and Stream C (the reasoning loop).

What

MVP / Acceptance (#8)

  • ChatRequest carries messages, tool/function declarations, gen config
  • ChatResponse carries text, structured tool_calls, token usage
  • no reqwest dependency in this module (pure data + trait)
  • unit test round-trips a hand-built response (+ object-safety test)

Tests

cargo test -p core agent:: → 21 passed (6 new).

Notes

Add core/src/agent/provider with the stable seam between the provider
layer (Stream A) and the reasoning loop (Stream C):

- LlmProvider trait: async complete(&ChatRequest, api_key) -> ChatResponse;
  Send+Sync and object-safe for Arc<dyn LlmProvider>. API key passed per
  call, never stored on the provider.
- Neutral types: ChatMessage/Role, ToolDeclaration, ToolCall,
  GenerationConfig, ChatRequest (+builders), TokenUsage (+Add), ChatResponse,
  FinishReason, ProviderError.
- No reqwest/network dependency; pure data + trait.
- 6 unit tests incl. serde round-trip and an in-memory provider proving
  object-safety (the shape #25/#44 rely on).

Re-exported from agent::mod. Closes #8.
@ammar-s847
ammar-s847 merged commit e305c14 into main May 27, 2026
2 checks passed
@ammar-s847
ammar-s847 deleted the agent/loop-provider branch May 27, 2026 22:13
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.

[A1] Define provider-neutral LlmProvider trait + types

1 participant