- agent/views.py: Move RateLimitError import inside format_error() function
to avoid loading openai SDK (~800ms) at module level
- llm/messages.py: Replace openai.BaseModel with pydantic.BaseModel directly
to remove unnecessary openai dependency
- filesystem/file_system.py: Move reportlab imports inside sync_to_disk_sync()
to avoid ~40ms startup cost when PDF generation is not used
- utils.py: Convert OpenAIBadRequestError and GroqBadRequestError to lazy
loaders to avoid loading SDKs at module level
This improves import time for users who don't use OpenAI provider,
especially when using Anthropic, Google, or other providers.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Removed redundant description from action field in AgentOutput and its subclasses.
- Updated action extraction documentation in Tools to clarify usage and limitations.
- Enhanced search_engine field description in SearchAction for better clarity on default behavior.
The issue occurred when calling agent.run() after using add_new_task(), because
the second run() attempted to dispatch CreateAgentSessionEvent to an already
shut down event queue from the first run.
This change:
- Adds session_initialized flag to AgentState to track if session events were dispatched
- Only dispatches CreateAgentSessionEvent on the first run() call
- CreateAgentTaskEvent is still dispatched on every run() as tasks can change
- Maintains all existing functionality while preventing the QueueShutDown exception
Fixes the workflow: agent.run() -> agent.add_new_task() -> agent.run() ✅🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>