Skip to content

Commit eebc007

Browse files
committed
Update README
1 parent 246ebca commit eebc007

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,60 @@ triage = AgentSpec(
507507
```
508508

509509

510+
### Autonomous Agents
511+
512+
**Agents** are emerging in production as LLMs mature in key capabilities—understanding complex inputs, engaging in reasoning and planning, using tools reliably, and recovering from errors.
513+
514+
```mermaid
515+
flowchart LR
516+
H([Human]) <-.-> TA[Agent] -.-> S([Stop])
517+
518+
subgraph TA[Agent]
519+
A[Agent]
520+
A --> |Action| E([Environment])
521+
E --> |Feedback| A
522+
end
523+
524+
style H fill:#ffb3ba,stroke-width:0px;
525+
style A fill:#baffc9,stroke-width:0px;
526+
style E fill:#ffb3ba,stroke-width:0px;
527+
style TA fill:#fff,stroke:#000,stroke-width:1px,stroke-dasharray: 2 2
528+
```
529+
530+
**When to use agents:** Agents can be used for open-ended problems where it’s difficult or impossible to predict the required number of steps, and where you can’t hardcode a fixed path. The Agent will potentially operate for many turns, and you must have some level of trust in its decision-making. Agents' autonomy makes them ideal for scaling tasks in trusted environments.
531+
532+
**Example** (see [examples/patterns/autonomous_agent.py](examples/patterns/autonomous_agent.py) for a runnable example):
533+
534+
```python
535+
from coagent.agents import Model
536+
from coagent.agents.react_agent import ReActAgent, RunContext
537+
from coagent.core import AgentSpec, new
538+
539+
async def get_current_city(ctx: RunContext) -> str:
540+
"""Get the current city."""
541+
ctx.report_progress(message="Getting the current city...")
542+
return "Beijing"
543+
544+
545+
async def query_weather(ctx: RunContext, city: str) -> str:
546+
"""Query the weather in the given city."""
547+
ctx.report_progress(message=f"Querying the weather in {city}...")
548+
return f"The weather in {city} is sunny."
549+
550+
551+
reporter = AgentSpec(
552+
"reporter",
553+
new(
554+
ReActAgent,
555+
name="weporter",
556+
system="You are a helpful weather reporter",
557+
model=Model(...),
558+
tools=[get_current_city, query_weather],
559+
),
560+
)
561+
```
562+
563+
510564
## Examples
511565

512566
- [patterns](examples/patterns)

coagent/agents/react_agent/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from typing_extensions import TypeVar
88

9-
from .types import FunctionToolCallProgressItem, ToolCallProgressItem, StreamEvent
9+
from .types import FunctionToolCallProgressItem, ToolCallProgressItem
1010

1111
TData = TypeVar("TData", default=Any)
1212

0 commit comments

Comments
 (0)