Skip to content

feat: use LLM to name agents automatically on ingestion (issue #33) - #38

Closed
JabbaKadabra wants to merge 1 commit into
masterfrom
feature/issue-33-ingestion-use-llm-to-name-an-agent-automatically
Closed

feat: use LLM to name agents automatically on ingestion (issue #33)#38
JabbaKadabra wants to merge 1 commit into
masterfrom
feature/issue-33-ingestion-use-llm-to-name-an-agent-automatically

Conversation

@JabbaKadabra

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a Name property to IAgent (domain, storage, DTO, API)
  • On first ingestion, AgentNamingService calls the provider's OpenAI-compatible endpoint with a lightweight prompt to generate a 2–5 word name for the agent; gracefully falls back to truncated system message text if the LLM call fails
  • The IAgentRepository.GetOrCreateAsync accepts a nameFactory delegate that is called only when a new agent is created — existing agents are unaffected
  • Demo seed data updated with descriptive names; AgentSeedData and JSON files updated accordingly
  • EF Core migration adds Name column (max 200 chars) to AgentEntity

Test plan

  • All existing tests pass (505 total)
  • New tests: GetOrCreateAsync_NameIsSetFromFactory and GetOrCreateAsync_ExistingAgent_NameFactoryNotCalled
  • Manual: proxy a real LLM call and verify the created agent has a descriptive name in the UI

Closes #33

🤖 Generated with Claude Code

)

- Add Name property to IAgent, Agent, AgentEntity, AgentConfig
- Add EF migration for Agent.Name column (max 200 chars)
- Add IAgentNamingService / AgentNamingService: calls the provider's LLM
  endpoint with a lightweight prompt to generate a 2-5 word name;
  falls back to heuristic (truncated system message) on failure
- Update IAgentRepository.GetOrCreateAsync to accept a nameFactory
  Func called only when a new agent is created, keeping the existing
  agent path unchanged
- Wire naming service into AgentCallIngestionService
- Expose Name in AgentDto and AgentsController
- Add Name to demo data seed files and AgentSeedData record
- Add tests: NameIsSetFromFactory, ExistingAgent_NameFactoryNotCalled

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@JabbaKadabra
JabbaKadabra deleted the feature/issue-33-ingestion-use-llm-to-name-an-agent-automatically branch April 29, 2026 18:04
JabbaKadabra added a commit that referenced this pull request Jul 27, 2026
CodeQL flagged two `cs/log-forging` sites (alerts #38, #39). The request
line cannot carry a raw newline, but a percent-encoded one survives URL
decoding: `/x%0D%0AINFO:%20admin%20logged%20in` reaches `Request.Path` as
two lines, and a flat-file or console sink renders the second as a log
entry of its own.

Add `ToSingleLogLine()` in Proxytrace.Common.Text and apply it at both
sites — the "response already started" warning in
ExceptionHandlingMiddleware and the missing-Passthrough-scope warning in
OpenAiProxyController.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DusPcXLc8APo1tUWKDHjmW
JabbaKadabra added a commit that referenced this pull request Jul 27, 2026
Sweeps the seven pre-existing `cs/log-forging` alerts (#15#21) with the
`ToSingleLogLine()` helper added for #38/#39: the upstream-failure
warnings in OpenAiProxyController and TraceyChatController, the
Not-implemented sibling in ExceptionHandlingMiddleware, the two
TestSupportController message logs, and both password-reset fallback
warnings in PasswordResetService.

These sites are on master rather than new to this branch, so they were
not blocking the merge — but they are the same defect and are now shipped
code, hence the CHANGELOG entry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DusPcXLc8APo1tUWKDHjmW
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.

Ingestion: Use LLM to Name an Agent automatically

1 participant