Skip to content

AgentPool: session routing, per-agent session options, greetings, and admin APIs#5

Merged
mahimairaja merged 2 commits intomainfrom
feat/plan-milestone-3-for-openrtc-project
Mar 19, 2026
Merged

AgentPool: session routing, per-agent session options, greetings, and admin APIs#5
mahimairaja merged 2 commits intomainfrom
feat/plan-milestone-3-for-openrtc-project

Conversation

@mahimairaja
Copy link
Copy Markdown
Collaborator

Motivation

  • Add deterministic session routing by job/room metadata and room-name prefix matching to make agent dispatch predictable.
  • Allow per-agent AgentSession options so callers can tune runtime behavior like preemptive generation and interruption handling.
  • Play configured agent greetings after the room connection completes and expose simple management helpers for registered agents.

Description

  • Introduce session_kwargs on AgentConfig and accept session_kwargs in AgentPool.add, preserving a copy via _copy_session_kwargs and forwarding them into AgentSession construction with **config.session_kwargs.
  • Implement enhanced routing in _resolve_agent that checks job metadata, room metadata, room name prefix matching (e.g. agentname-...), and falls back to the first registered agent, plus support for both agent and demo metadata keys via _agent_name_from_mapping.
  • Generate configured greetings after ctx.connect() by calling await session.generate_reply(instructions=config.greeting) when greeting is set, and adjust related logging levels and messages.
  • Add get and remove convenience methods for registered agents and update README with the new session routing and greeting behavior.
  • Add and update unit tests to cover session kwargs copying, get/remove behavior, routing precedence, room-name prefix routing, greeting generation timing, and AgentSession argument propagation.

Testing

  • Ran the updated unit tests in tests/test_pool.py which include test_add_stores_session_kwargs_copy, test_get_returns_registered_agent, and test_remove_returns_removed_agent, and they passed.
  • Ran the new routing tests in tests/test_routing.py which validate metadata precedence, demo support, room prefix matching, default fallback behavior, session kwargs forwarding, and greeting generation timing, and they passed.
  • Executed the test suite with pytest and observed all added and existing tests succeeding.

Codex Task

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 19, 2026

Warning

Rate limit exceeded

@mahimairaja has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ee695e9f-7156-4e27-b311-852c502bdf3d

📥 Commits

Reviewing files that changed from the base of the PR and between b2e5b46 and 6c49168.

📒 Files selected for processing (4)
  • README.md
  • src/openrtc/pool.py
  • tests/test_pool.py
  • tests/test_routing.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/plan-milestone-3-for-openrtc-project
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mahimairaja mahimairaja merged commit 26b6c11 into main Mar 19, 2026
6 checks passed
@mahimairaja mahimairaja deleted the feat/plan-milestone-3-for-openrtc-project branch March 23, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant