chore: release api v1.0.0
- Event-based streaming for task agent - Retry logic when LLM responds without calling tools - Hardened prompts to enforce tool use - Working directory context in all agent prompts - Project paused: local LLMs not capable enough for agentic use Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -79,6 +79,14 @@ class ExploreAgentImpl(BaseAgent):
|
||||
from src.domains.agents.explore.tools import register_explore_tools
|
||||
register_explore_tools(agent)
|
||||
|
||||
def _build_prompt_with_context(self, prompt: str, working_dir: str) -> str:
|
||||
"""Build the prompt with working directory context."""
|
||||
return f"""Working directory: {working_dir}
|
||||
|
||||
Use paths within this working directory for file operations.
|
||||
|
||||
User request: {prompt}"""
|
||||
|
||||
@logged()
|
||||
async def run(
|
||||
self,
|
||||
@@ -98,16 +106,20 @@ class ExploreAgentImpl(BaseAgent):
|
||||
Returns:
|
||||
Agent response with findings
|
||||
"""
|
||||
effective_working_dir = working_dir or os.getcwd()
|
||||
|
||||
ctx = ExploreContext(
|
||||
working_dir=working_dir or os.getcwd(),
|
||||
working_dir=effective_working_dir,
|
||||
allowed_paths=allowed_paths or self._settings.effective_allowed_paths,
|
||||
timeout_seconds=self._settings.tool_timeout_seconds,
|
||||
)
|
||||
|
||||
full_prompt = self._build_prompt_with_context(prompt, effective_working_dir)
|
||||
|
||||
async with trace_span("explore_agent_run"):
|
||||
try:
|
||||
# Use run() not run_stream() - Ollama has bugs with streaming + tools
|
||||
result = await self.agent.run(prompt, deps=ctx)
|
||||
result = await self.agent.run(full_prompt, deps=ctx)
|
||||
return result.output
|
||||
except Exception as e:
|
||||
logger.exception(f"Explore agent error: {e}")
|
||||
@@ -126,15 +138,19 @@ class ExploreAgentImpl(BaseAgent):
|
||||
|
||||
Yields text chunks as they become available.
|
||||
"""
|
||||
effective_working_dir = working_dir or os.getcwd()
|
||||
|
||||
ctx = ExploreContext(
|
||||
working_dir=working_dir or os.getcwd(),
|
||||
working_dir=effective_working_dir,
|
||||
allowed_paths=allowed_paths or self._settings.effective_allowed_paths,
|
||||
timeout_seconds=self._settings.tool_timeout_seconds,
|
||||
)
|
||||
|
||||
full_prompt = self._build_prompt_with_context(prompt, effective_working_dir)
|
||||
|
||||
async with trace_span("explore_agent_stream"):
|
||||
try:
|
||||
async with self.agent.run_stream(prompt, deps=ctx) as result:
|
||||
async with self.agent.run_stream(full_prompt, deps=ctx) as result:
|
||||
async for chunk in result.stream_text():
|
||||
yield chunk
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user