Commit Graph

1066 Commits

Author SHA1 Message Date
Eric Zhu e7b47700da
doc: update guide for termination condition and tool usage (#5807)
Resolves #5786

Also updated the termination tutorial to include an example of a custom
termination conditon.

Also added to guide about FunctionTool and MCP tools.
2025-03-03 22:26:27 -08:00
Eric Zhu 4858676bdd
Add examples for custom model context in AssistantAgent and ChatCompletionContext (#5810)
Resolves #5777
2025-03-03 22:19:59 -08:00
Eric Zhu cc1b0cdd51
feat: Add FunctionCallTermination condition (#5808)
Add function call termination condition.

Useful as an alternative to TextMentionTermination for models with tool
call capability.
2025-03-04 03:26:47 +00:00
Paul Barbaste da10765474
Update magentic-one.md (#5779)
## Why are these changes needed?

The current installation command fails in certain shells (e.g., `zsh`,
`fish`) because brackets (`[]`) are interpreted as special characters.
Adding quotes ensures compatibility across different environments,
including Linux, macOS, and Windows.

## Related issue number

No related issue, but this fixes an installation issue encountered by
multiple users.

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-03-04 00:48:08 +00:00
LuSrackhall 897efcca99
Update installation.md (#5784)
## Why are these changes needed?

* `python3` to `python`: Windows uses `python` for Python 3 by default,
not `python3`.
* `bin` to `scripts`: Windows virtual environments use `Scripts` instead
of `bin`.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-03-04 00:41:52 +00:00
Muhammad Junaid 0b9a622b56
Fix: Auto-Convert Pydantic and Dataclass Arguments in AutoGen Tool Calls (#5737)
AutoGen was passing raw dictionaries to functions instead of
constructing Pydantic model or dataclass instances. If a tool function’s
parameter was a Pydantic BaseModel or a dataclass, the function would
receive a dict and likely throw an error or behave incorrectly (since it
expected an object of that type).

This PR addresses problem in AutoGen where tool functions expecting
structured inputs (Pydantic models or dataclasses) were receiving raw
dictionaries. It ensures that structured inputs are automatically
validated and instantiated before function calls. Complete details are
in Issue #5736

[Reproducible Example Code - Failing
Case](https://colab.research.google.com/drive/1hgoP-cGdSZ1-OqQLpwYmlmcExgftDqlO?usp=sharing)
 
<!-- Please give a short summary of the change and the problem this
solves. -->
## Changes Made:
- Inspect function signatures for Pydantic BaseModel and dataclass
annotations.
- Convert input dictionaries into properly instantiated objects using
BaseModel.model_validate() for Pydantic models or standard instantiation
for dataclasses.
  - Raise descriptive errors when validation or instantiation fails.
  - Unit tests have been added to cover all scenarios

Now structured inputs are automatically validated and instantiated
before function calls.

- **Updated Conversion Logic:**  
In the `run()` method, we now inspect the function’s signature and
convert input dictionaries to structured objects. For parameters
annotated with a Pydantic model, we use `model_validate()` to create an
instance; for those annotated with a dataclass, we instantiate the
object using the dataclass constructor. For example:

  ```python
  # Get the function signature.
  sig = inspect.signature(self._func)
  raw_kwargs = args.model_dump()
  kwargs = {}

  # Iterate over the parameters expected by the function.
  for name, param in sig.parameters.items():
      if name in raw_kwargs:
          expected_type = param.annotation
          value = raw_kwargs[name]
# If expected type is a subclass of BaseModel, perform conversion.
if inspect.isclass(expected_type) and issubclass(expected_type,
BaseModel):
              try:
                  kwargs[name] = expected_type.model_validate(value)
              except ValidationError as e:
                  raise ValueError(
f"Error validating parameter '{name}' for function
'{self._func.__name__}': {e}"
                  ) from e
          # If it's a dataclass, instantiate it.
          elif is_dataclass(expected_type):
              try:
cls = expected_type if isinstance(expected_type, type) else
type(expected_type)
                  kwargs[name] = cls(**value)
              except Exception as e:
                  raise ValueError(
f"Error instantiating dataclass parameter '{name}' for function
'{self._func.__name__}': {e}"
                  ) from e
          else:
              kwargs[name] = value
  ```

- **Error Handling Improvements:**  
Conversion steps are wrapped in try/except blocks to raise descriptive
errors when instantiation fails, aiding in debugging invalid inputs.

- **Testing:**  
Unit tests have been added to simulate tool calls (e.g., an `add` tool)
to ensure that with input like:
  ```json
  {"input": {"x": 2, "y": 3}}
  ```
The tool function receives an instance of the expected type and returns
the correct result.


## Related issue number
Closes #5736
 
## Checks
- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-03-03 16:35:27 -08:00
laurentran 3d5e4c8d7b
Update with correct message types (#5789)
Correcting an error: If CodeReviewResult is not approved, the coder
agents sends a CodeReviewTask back to the reviewer agent, not a
CodeWritingTask.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-03-03 23:46:53 +00:00
Victor Dibia 1b51e69602
add api docstring to with_requirements (#5746)
Starting out this draft PR to add documentation for the
`with_requirements` decorator in the `autogen-core` package.

---------

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
2025-03-03 23:35:10 +00:00
Eitan Yarmush 9d4236b1ce
TextMessageTerminationCondition for agentchat (#5742)
Closes #5732 
---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-03-03 23:29:25 +00:00
Leonardo Pinheiro 906b09e451
fix: Update SKChatCompletionAdapter message conversion (#5749)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

The PR introduces two changes.

The first change is adding a name attribute to
`FunctionExecutionResult`. The motivation is that semantic kernel
requires it for their function result interface and it seemed like a
easy modification as `FunctionExecutionResult` is always created in the
context of a `FunctionCall` which will contain the name. I'm unsure if
there was a motivation to keep it out but this change makes it easier to
trace which tool the result refers to and also increases api
compatibility with SK.

The second change is an update to how messages are mapped from autogen
to semantic kernel, which includes an update/fix in the processing of
function results.

## Related issue number

<!-- For example: "Closes #1234" -->

Related to #5675 but wont fix the underlying issue of anthropic
requiring tools during AssistantAgent reflection.

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com>
2025-03-03 23:05:54 +00:00
YASAI03 7e01350d46
fix(studio): Fixed an issue where the app would crash if a team was not set when opening a playground page. (#5794)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

(I'm not familiar with English, so I use Goggle translation a lot. So
please forgive me if I say something rude.)
I started autogen-studio and opened the page in the browser, nothing was
rendered.
I checked using the Developer tool, the following error appeared:
```
TypeError: Cannot read properties of null (reading 'label')
at editor.tsx:114:42
```
I check the implementation, it looks like `team.component` is `null`,
which seems to be caused during initialization process when the team is
not registered.
[source](78ff883d24/python/packages/autogen-studio/frontend/src/components/views/playground/manager.tsx (L199))

So I fixed the issue where the gallery wasn't being retrieved which was
causing the issue.

### Reproduce bug

1. clone this repository
2. open devcontainer(`python/packages/autogen-studio`)
3. Running the application
```sh
cd frontend
yarn build
cd -
OPENAI_API_KEY="" autogenstudio ui --port 8081
```
4. Open `localhost:8081` in browser.

## Related issue number

<!-- For example: "Closes #1234" -->

Probably not found. (sorry if I had to raise an issue before PR)

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [-] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-03-03 14:25:40 -08:00
Peter Jausovec a785cd90f9
add stream_options to openai model (#5788)
stream_options are not part of the model classes, so they won't get
serialized when calling dump_component. Adding this to the model allows
us to store the stream options when the component is serialized.
---------

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-03-03 21:58:05 +00:00
Victor Dibia 679a9357f8
Fix AGS Cascading Delete Issue (#5804)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

> Hey Victor, this is maybe a bug, but when a session is delete, runs
and messages for that session are not deleted, any reason why to keep
them?

@husseinmozannar 

The main fix is to add a pragma that ensures SQL lite enforces foreign
key constraints.
Also needed to update error messages for autoupgrade of databases. Also
adds a test for cascade deletes and for parts of teammanager

With this fix,

- Messages get deleted when the run is deleted 
- Runs get deleted when sessiosn are deleted 
- Sessions get deleted when a team is deleted 

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-03-03 21:46:57 +00:00
peterychang 8c9961ecba
add options to ollama client (#5805)
Necessary to configure ollama client

## Related issue number

#5597 

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-03-03 13:24:14 -08:00
Victor Dibia dd1ade816e
Add Git LFS Note to AGS Readme (#5798)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->



## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

- AGS contains image files which are required for local build /dev
- These files are stored using git lfs which needs to be run before the
files are downloaded
- This PR adds a reminder to the AGS readme to run `git lfs checkout`
after installing git lfs to download the image files

## Related issue number

<!-- For example: "Closes #1234" -->

Close #3418

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-03-03 12:39:25 -08:00
Jay Prakash Thakur 78ff883d24
docs: add note about markdown code block requirement in CodeExecutorA… (#5785)
## Why are these changes needed?

The CodeExecutorAgent documentation needs to be updated to explicitly
mention that it only processes code properly formatted in markdown code
blocks with triple backticks. This change adds a clear note with
examples to help users understand the required format for code
execution.

## Related issue number

Closes #5771


Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-03-02 17:00:08 -08:00
Victor Dibia b8b13935c9
Make FileSurfer and CodeExecAgent Declarative (#5765)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Make FileSurfer and CodeExecAgent Declarative.
These agent presents are used as part of magentic one and having them
declarative is a precursor to their use in AGS.

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->
Closes #5607

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-03-01 15:46:30 +00:00
Victor Dibia 78ef148c88
Add ChromaDBVectorMemory in Extensions (#5308)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->
Shows an example of how to use the `Memory` interface to implement a
just-in-time vector memory based on chromadb.

```python
import os
from pathlib import Path

from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.ui import Console
from autogen_core.memory import MemoryContent, MemoryMimeType
from autogen_ext.memory.chromadb import ChromaDBVectorMemory, PersistentChromaDBVectorMemoryConfig
from autogen_ext.models.openai import OpenAIChatCompletionClient

# Initialize ChromaDB memory with custom config
chroma_user_memory = ChromaDBVectorMemory(
    config=PersistentChromaDBVectorMemoryConfig(
        collection_name="preferences",
        persistence_path=os.path.join(str(Path.home()), ".chromadb_autogen"),
        k=2,  # Return top  k results
        score_threshold=0.4,  # Minimum similarity score
    )
)
# a HttpChromaDBVectorMemoryConfig is also supported for connecting to a remote ChromaDB server

# Add user preferences to memory
await chroma_user_memory.add(
    MemoryContent(
        content="The weather should be in metric units",
        mime_type=MemoryMimeType.TEXT,
        metadata={"category": "preferences", "type": "units"},
    )
)

await chroma_user_memory.add(
    MemoryContent(
        content="Meal recipe must be vegan",
        mime_type=MemoryMimeType.TEXT,
        metadata={"category": "preferences", "type": "dietary"},
    )
)


# Create assistant agent with ChromaDB memory
assistant_agent = AssistantAgent(
    name="assistant_agent",
    model_client=OpenAIChatCompletionClient(
        model="gpt-4o",
    ),
    tools=[get_weather],
    memory=[user_memory],
)

stream = assistant_agent.run_stream(task="What is the weather in New York?")
await Console(stream)

await user_memory.close()
```

```txt
 ---------- user ----------
What is the weather in New York?
---------- assistant_agent ----------
[MemoryContent(content='The weather should be in metric units', mime_type='MemoryMimeType.TEXT', metadata={'category': 'preferences', 'mime_type': 'MemoryMimeType.TEXT', 'type': 'units', 'score': 0.4342913043162201, 'id': '8a8d683c-5866-41e1-ac17-08c4fda6da86'}), MemoryContent(content='The weather should be in metric units', mime_type='MemoryMimeType.TEXT', metadata={'category': 'preferences', 'mime_type': 'MemoryMimeType.TEXT', 'type': 'units', 'score': 0.4342913043162201, 'id': 'f27af42c-cb63-46f0-b26b-ffcc09955ca1'})]
---------- assistant_agent ----------
[FunctionCall(id='call_a8U3YEj2dxA065vyzdfXDtNf', arguments='{"city":"New York","units":"metric"}', name='get_weather')]
---------- assistant_agent ----------
[FunctionExecutionResult(content='The weather in New York is 23 °C and Sunny.', call_id='call_a8U3YEj2dxA065vyzdfXDtNf', is_error=False)]
---------- assistant_agent ----------
The weather in New York is 23 °C and Sunny.
```

Note that MemoryContent object in the MemoryQuery events have useful
metadata like the score and id retrieved memories.

## Related issue number

<!-- For example: "Closes #1234" -->


## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-03-01 07:41:01 -08:00
Peter Jausovec 7bbf8e075d
fix incorrect field name from config to component (#5761)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

The Team DB class doesn't have the "config" field anymore. It has
"component"

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-02-28 19:23:59 -08:00
Victor Dibia 6625f89c28
Add support for default model client, in AGS updates to settings UI (#5763)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Add support for default model client, in AGS updates to settings UI. 
A default model client will be used for subsequent background tasks
(e.g, automatically naming sessions to meaningful names).

<img width="1441" alt="image"
src="https://github.com/user-attachments/assets/31675ef4-8f80-4a8c-9762-3d6bcbc6d33d"
/>


<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #5685

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-28 16:37:51 -08:00
Stuart Leeks 07a455f239
Fix typo (#5754)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->
Typo in example text

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [X] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [X] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [X] I've made sure all auto checks have passed.
2025-02-28 10:33:19 -05:00
Victor Dibia dd0781a76b
Add Serialization Instruction for MemoryContent (#5727)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

- Running a team generates a MemoryQueryEvent has a MemoryContent field
and is part of the model context
- Saving team state (`team.save_state()`) includes serializing model
context
- MemoryContent has a mime_type field, which was not being properly
serialized.
"Object of type MemoryMimeType is not JSON serializable"

This PR? -> add explicit serialization instruction for the mimetype
field.

```python
import asyncio
import logging
import json
import yaml, aiofiles
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_agentchat.conditions import MaxMessageTermination
from autogen_core.memory import ListMemory, MemoryContent, MemoryMimeType
from autogen_agentchat.ui import Console

logger = logging.getLogger(__name__)

state_path = "team_state.json"

model_client =  OpenAIChatCompletionClient(model="gpt-4o-mini")

max_msg_termination = MaxMessageTermination(max_messages=3)
# Initialize user memory
user_memory = ListMemory()

# Add user preferences to memory
await user_memory.add(MemoryContent(content="The weather should be in metric units", mime_type=MemoryMimeType.TEXT))

# Create the team.
agent = AssistantAgent(
    name="assistant",
    model_client=model_client,
    system_message="You are a helpful assistant.",
    memory = [user_memory],
)
yoda = AssistantAgent(
    name="yoda",
    model_client=model_client,
    system_message="Repeat the same message in the tone of Yoda.",
)

team = RoundRobinGroupChat(
    [agent, yoda],
    termination_condition=max_msg_termination
)

await Console(team.run_stream(task="Hi, How are you ?"))
 
# Save team state to file.
state = await team.save_state()
with open(state_path, "w") as f:
    json.dump(state, f)
# Load team state from file.
with open("team_state.json", "r") as f:
    team_state = json.load(f)
    
await team.load_state(state) 
await Console( team.run_stream(task="What was the last thing that was said in this conversation "))
```

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #5688
## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-26 18:40:00 +00:00
Jack Gerrits 6b68719939
Allow background exceptions to be fatal (#5716)
Closes #4904 

Does not change default behavior in core.

In agentchat, this change will mean that exceptions that used to be
ignored and result in bugs like the group chat stopping are now reported
out to the user application.

---------

Co-authored-by: Ben Constable <benconstable@microsoft.com>
Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2025-02-26 18:34:53 +00:00
peterychang dc55ec964b
Fix visual accessibility issues 6 and 20 (#5725)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Fixes visual accessibility issues `(6) Luminosity contrast ratio of
focus indicator on 'Venv' control is less than 3:1.` and `(20) "Only
color is used to indicate the focus indicator on the 'Venv', and 'conda'
Tab controls."`

## Related issue number

#5633 

before:
<img width="162" alt="image"
src="https://github.com/user-attachments/assets/ac317e82-c82e-4d3b-910b-e9eb5d087340"
/>

![image](https://github.com/user-attachments/assets/2971043a-8b5b-4521-8135-c411c0ecab1f)

after:
<img width="160" alt="image"
src="https://github.com/user-attachments/assets/8053ae77-4d62-491b-9d78-657646ed71a6"
/>

![image](https://github.com/user-attachments/assets/5c3ac2c3-4813-461b-8958-4665860574a0)
2025-02-26 11:59:07 -05:00
rylativity 5615f40a30
5663 ollama client host (#5674)
@ekzhu should likely be assigned as reviewer

## Why are these changes needed?

These changes address the bug reported in #5663. Prevents TypeError from
being thrown at inference time by ollama AsyncClient when `host` (and
other) kwargs are passed to autogen OllamaChatCompletionClient
constructor.

It also adds ollama as a named optional extra so that the ollama
requirements can be installed alongside autogen-ext (e.g. `pip install
autogen-ext[ollama]`

@ekzhu, I will need some help or guidance to ensure that the associated
test (which requires ollama and tiktoken as dependencies of the
OllamaChatCompletionClient) can run successfully in autogen's test
execution environment.

I have also left the "I've made sure all auto checks have passed" check
below unchecked as this PR is coming from my fork. (UPDATE: auto checks
appear to have passed after opening PR, so I have checked box below)

## Related issue number

Intended to close #5663 

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Ryan Stewart <ryanstewart@Ryans-MacBook-Pro.local>
Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
Co-authored-by: peterychang <49209570+peterychang@users.noreply.github.com>
2025-02-26 11:02:48 -05:00
Victor Dibia 05fc763b8a
add anthropic native support (#5695)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

Claude 3.7 just came out. Its a pretty capable model and it would be
great to support it in Autogen.
This will could augment the already excellent support we have for
Anthropic via the SKAdapters in the following ways

- Based on the ChatCompletion API similar to the ollama and openai
client
- Configurable/serializable (can be dumped) .. this means it can be used
easily in AGS.

## What is Supported 

(video below shows the client being used in autogen studio)

https://github.com/user-attachments/assets/8fb7c17c-9f9c-4525-aa9c-f256aad0f40b



- streaming 
- tool callign / function calling 
- drop in integration with assistant agent. 
- multimodal support

```python

from dotenv import load_dotenv
import os 

load_dotenv()

from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.ui import Console
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.models.anthropic import AnthropicChatCompletionClient 
model_client =   AnthropicChatCompletionClient(
        model="claude-3-7-sonnet-20250219" 
    )

async def get_weather(city: str) -> str:
    """Get the weather for a given city."""
    return f"The weather in {city} is 73 degrees and Sunny."

 
agent = AssistantAgent(
    name="weather_agent",
    model_client=model_client,
    tools=[get_weather],
    system_message="You are a helpful assistant.", 
    # model_client_stream=True,   
)

# Run the agent and stream the messages to the console.
async def main() -> None:
    await Console(agent.run_stream(task="What is the weather in New York?"))
await main()
```

result 

```
messages = [
    UserMessage(content="Write a very short story about a dragon.", source="user"),
]

# Create a stream.
stream = model_client.create_stream(messages=messages)

# Iterate over the stream and print the responses.
print("Streamed responses:")
async for response in stream:  # type: ignore
    if isinstance(response, str):
        # A partial response is a string.
        print(response, flush=True, end="")
    else:
        # The last response is a CreateResult object with the complete message.
        print("\n\n------------\n")
        print("The complete response:", flush=True)
        print(response.content, flush=True)
        print("\n\n------------\n")
        print("The token usage was:", flush=True)
        print(response.usage, flush=True)
```

 

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" --> 

Closes #5205 
Closes #5708

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed. 



cc @rohanthacker
2025-02-26 07:27:41 +00:00
Victor Dibia 1f30622adc
update human in the loop docs for agentchat (#5720)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

update human in the loop docs for agentchat  
..

> Outputs in docs are outdated as summary is not printed out by default
when using Console
[#5590](https://github.com/microsoft/autogen/issues/5590)

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->
Closes #5590

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-25 23:15:33 -08:00
gagb 173e649aa6
Update README.md for improved clarity and formatting (#5714)
This pull request includes updates to the `README.md` file for the
`autogen-studio` package to improve clarity and accuracy. The most
important changes include a minor rewrite of the project structure
section and updates to the installation instructions (better tabbing).
2025-02-25 19:28:05 -08:00
Jack Gerrits 1380412582
Specify specific UV version should be used (#5711)
Closes #5710
2025-02-25 19:47:20 +00:00
peterychang 73f26792ab
Fix accessibility issue 14 for visual accessibility (#5709)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Fixes `(14) Ensures the contrast between foreground and background
colors meets WCAG 2 AA minimum contrast ratio thresholds`

Note: the color values don't output at the exact values on the
stylesheet. For example, the value `#1774E5` evaluates to `#2274E0` by
the Accessibility Insights app.

## Related issue number

https://github.com/microsoft/autogen/issues/5633

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-25 19:19:14 +00:00
Leonardo Pinheiro a02d08a8ef
Refactor AssistantAgent on_message_stream (#5642)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

I'm unsure if everyone will agree, but I started to look into adding new
logic and found that refactoring into smaller functions would make it
more maintainable.

There is no change in functionality, only a breakdown into smaller
methods to make it more modular and improve readability. There is a lot
of logic in the method and this refactor breaks it down into context
management, llm call and result processing.

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com>
2025-02-25 19:11:35 +00:00
pengjunfeng11 a06b6c8b0b
REF: replaced variable name in TextMentionTermination (#5698)
## Why are these changes needed?

For the sake of subsequent people reading the metacode and following
programming specifications, variable names are updated in combination
with usage scenarios. Mainly contains the variable "_self_text" in
TextMentionTermination
2025-02-25 16:00:41 +00:00
Victor Dibia fbe94dd7ed
Add Token Streaming in AGS , Support Env variables (#5659)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

This PR has 3 main improvements. 

- Token streaming 
- Adds support for environment variables in the app settings 
- Updates AGS to persist Gallery entry in db.

## Adds Token Streaming in AGS.  

Agentchat now supports streaming of tokens via
`ModelClientStreamingChunkEvent `. This PR is to track progress on
supporting that in the AutoGen Studio UI.

If `model_client_stream` is enabled in an assitant agent, then token
will be streamed in UI.

```python
streaming_assistant = AssistantAgent(
    name="assistant",
    model_client=model_client,
    system_message="You are a helpful assistant.",
    model_client_stream=True,  # Enable streaming tokens.
)

```

https://github.com/user-attachments/assets/74d43d78-6359-40c3-a78e-c84dcb5e02a1


## Env Variables 
Also adds support for env variables in AGS Settings

You can set env variables that are loaded just before a team is run.
Handy to set variable to be used by tools etc.

<img width="1291" alt="image"
src="https://github.com/user-attachments/assets/437b9d90-ccee-42f7-be5d-94ab191afd67"
/>


> Note: the set variables are available to the server process.

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->
Closes #5627  
Closes #5662 
Closes #5619 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-25 15:21:08 +00:00
Hussein Mozannar 4dac9c819e
Add metadata field to basemessage (#5372)
Add metadata field to BaseMessage.

Why?
- additional metadata field can track 1) timestamp if needed, 2) flags
about the message. For instance, a use case is a metadata field
{"internal":"yes"} that would hide messages from being displayed in an
application or studio.

As long as an extra field is added to basemessage that is not consumed
by existing agents, I am happy.



Notes:
- We can also only add it to BaseChatMessage, that would be fine
- I don't care what the extra field is called as long as there is an
extra field somewhere
- I don't have preference for the type, a str could work, but a dict
would be more useful.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-25 06:54:49 +00:00
Eric Zhu c302b5408a
doc: Update SelectorGroupChat doc on how to use O3-mini model. (#5657)
Resolves #5408

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
2025-02-25 06:44:23 +00:00
Eric Zhu a14aeab6e4
doc & sample: Update documentation for human-in-the-loop and UserProxyAgent; Add UserProxyAgent to ChainLit sample; (#5656)
Resolves #5610

And address various questions regarding to how to use user proxy agent
and human-in-the-loop.
2025-02-25 01:41:15 +00:00
Eric Zhu 6bc896f6e2
update versions to 0.4.8 (#5689) 2025-02-24 23:46:37 +00:00
Ryan Sweet 78adf32f7d
pack agenthost as tool (#5647)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

convenience - allows to just run "agenthost"

```
dotnet pack --no-build --configuration Release --output './output/release' -bl\n
dotnet tool install --add-source ./output/release Microsoft.AutoGen.AgentHost
agenthost 
```

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

closes #5646 

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-24 14:23:45 -08:00
Shubham Shukla caa363b517
Replace the undefined tools variable with tool_schema parameter in ToolUseAgent class (#5684)
Replace the undefined `tools` variable with `tool_schema` parameter

<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?
This change keeps the documentation up to date :
https://microsoft.github.io/autogen/stable//user-guide/core-user-guide/components/tools.html

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-24 17:41:45 +00:00
Eric Zhu 0360ab9715
doc: Enrich AssistantAgent API documentation with usage examples. (#5653)
Resolves #5562
2025-02-24 10:57:34 -05:00
Eric Zhu 08c82e4c6f
docs: Add logging instructions for AgentChat and enhance core logging guide (#5655)
Resolves #5640
2025-02-24 14:39:38 +00:00
Christoph Schittko 64807d24f5
DOCS: Fixed small errors in the text and made code format more consistent (#5664)
## Why are these changes needed?

Fix minor issues in docs:
- probably editing left over
- typo
- code formatting inconsistency

## Related issue number

N/A

## Checks

- [ X] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ X] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ X] I've made sure all auto checks have passed.

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
2025-02-24 14:28:17 +00:00
Eric Zhu 9fd8eefc55
fix: Structured output with tool calls for OpenAIChatCompletionClient (#5671)
Resolves: #5568

Also, refactored some unit tests.

Integration tests against OpenAI endpoint passed:
https://github.com/microsoft/autogen/actions/runs/13484492096

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
2025-02-24 14:18:46 +00:00
linznin 2570cc9cf3
Fix: Add support for custom headers in HTTP tool requests (#5660)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

The HttpTool in AutoGen accepts a headers parameter, but it is not being
used in the actual request. This fix ensures that the headers provided
by users are correctly included in HTTP requests. This resolves issues
where authentication or other custom headers are required but currently
ignored.

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->
Closes #5638

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
2025-02-24 13:52:58 +00:00
Christoph Schittko 87495c67c3
DOCS: Minor updates to handoffs.ipynb (#5665)
Updates:
- added missing backtick for formatting class name
- typo in user response example

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-24 06:40:50 +00:00
philippHorn 95585b4408
fix: Crash in argument parsing when using Openrouter (#5667)
## Why are these changes needed?
See issue for a bug description.
The problem was that a lot of openrouter models return `""` as
`tool_call.arguments`, which caused `json.loads` to fail
## Related issue number
https://github.com/microsoft/autogen/issues/5666
---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-23 22:35:13 -08:00
Victor Dibia 170b8cc893
Make ChatCompletionCache support component config (#5658)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

This PR makes makes ChatCompletionCache   support component config

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed? 

Ensures we have a path to serializing ChatCompletionCache , similar to
the ChatCompletion client that it wraps.

This PR does the following

- Makes CacheStore serializable first (part of this includes converting
from Protocol to base class). Makes it's derivatives serializable as
well (diskcache, redis)
- Makes ChatCompletionCache serializable 
- Adds some tests

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #5141

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed. 


cc @nour-bouzid
2025-02-23 19:49:22 -08:00
Eric Zhu a226966dbe
fix: Remove R1 model family from is_openai function (#5652) 2025-02-21 16:22:14 -07:00
Eric Zhu 7784f44ea6
feat: Add thought process handling in tool calls and expose ThoughtEvent through stream in AgentChat (#5500)
Resolves #5192

Test

```python
import asyncio
import os
from random import randint
from typing import List
from autogen_core.tools import BaseTool, FunctionTool
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.ui import Console

async def get_current_time(city: str) -> str:
    return f"The current time in {city} is {randint(0, 23)}:{randint(0, 59)}."

tools: List[BaseTool] = [
    FunctionTool(
        get_current_time,
        name="get_current_time",
        description="Get current time for a city.",
    ),
]

model_client = OpenAIChatCompletionClient(
    model="anthropic/claude-3.5-haiku-20241022",
    base_url="https://openrouter.ai/api/v1",
    api_key=os.environ["OPENROUTER_API_KEY"],
    model_info={
        "family": "claude-3.5-haiku",
        "function_calling": True,
        "vision": False,
        "json_output": False,
    }
)

agent = AssistantAgent(
    name="Agent",
    model_client=model_client,
    tools=tools,
    system_message= "You are an assistant with some tools that can be used to answer some questions",
)

async def main() -> None:
    await Console(agent.run_stream(task="What is current time of Paris and Toronto?"))

asyncio.run(main())
```

```
---------- user ----------
What is current time of Paris and Toronto?
---------- Agent ----------
I'll help you find the current time for Paris and Toronto by using the get_current_time function for each city.
---------- Agent ----------
[FunctionCall(id='toolu_01NwP3fNAwcYKn1x656Dq9xW', arguments='{"city": "Paris"}', name='get_current_time'), FunctionCall(id='toolu_018d4cWSy3TxXhjgmLYFrfRt', arguments='{"city": "Toronto"}', name='get_current_time')]
---------- Agent ----------
[FunctionExecutionResult(content='The current time in Paris is 1:10.', call_id='toolu_01NwP3fNAwcYKn1x656Dq9xW', is_error=False), FunctionExecutionResult(content='The current time in Toronto is 7:28.', call_id='toolu_018d4cWSy3TxXhjgmLYFrfRt', is_error=False)]
---------- Agent ----------
The current time in Paris is 1:10.
The current time in Toronto is 7:28.
```

---------

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
2025-02-21 13:58:32 -08:00
Victor Dibia 45c6d133c2
Update AGS, Remove Numpy Dep (#5648)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

Update AGS, Remove Numpy Dep

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #5639

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-21 15:33:15 -05:00
Victor Dibia 2f43005624
Improve Gallery Editor UX in AGS (#5613)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed? 

Fixes the problem where Gallery items could only be modified via JSON 

This PR does the following

- Refactor TeamBuilder to have modular component editor UI primarily
focused on editing each component type.
- Refactor the Gallery UX 
   - improve layout to use tabs for each component type 
- enable editing of each component item by reusing the component editor
- Enable switching between form editing and UI editing for coponent
editor view

This way, gallery items can be readily modified and then reused in the
component library in team builder.
It also implements an upate to the Gallery data structure to make it
more intuitive - it has a components field that has teams, agents,
models ...

<img width="1598" alt="image"
src="https://github.com/user-attachments/assets/3c3a228a-0bd2-4fc1-85ec-c9685c80bf72"
/>
<img width="1614" alt="image"
src="https://github.com/user-attachments/assets/5b6ed840-9c48-47bc-8c17-2aa50c7dcb99"
/>


<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #5465 
Closes #5047
 
cc @nour-bouzid @balakreshnan @EItanya @joslat @IustinT @leonG7
## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-20 21:51:05 -08:00
Wei Jen Lu 34d30b56f5
Fix typo in doc (#5628)
Fix typo in doc

<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [x] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-20 14:07:44 -05:00
OndeVai df829a133f
Fixing grammar issues (#5537)
Fixing grammar issues

<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-19 15:38:58 +00:00
gagb fa3396e9c3
Initialize BaseGroupChat before reset (#5608)
Fixes #5366 

Solution: Instead of raising an error called `_init()`

---------

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
2025-02-19 15:03:54 +00:00
Li Jiang a0e3a1208c
Improve the model mismatch warning msg (#5586) 2025-02-19 01:17:41 +00:00
peterychang 2842c76aeb
Ollama client docs (#5605)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Adds ollama client documentation to the docs page

## Related issue number

https://github.com/microsoft/autogen/issues/5604

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-18 16:25:51 -05:00
peterychang 4959b24777
Fix ollama docstring (#5600)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Initial commit's docstrings were incorrect, which would be confusing for
a user

## Related issue number

https://github.com/microsoft/autogen/issues/5595
2025-02-18 13:38:35 -05:00
peterychang 8294c4c65e
Ollama client (#5553)
## Why are these changes needed?

Adds a client for ollama models

## Related issue number

https://github.com/microsoft/autogen/issues/5595

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-18 11:39:34 -05:00
Victor Dibia e02db84586
Improves editing UI for tools in AGS (#5539)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->
<img width="1560" alt="image"
src="https://github.com/user-attachments/assets/da3d781f-2572-4bd7-802d-1d3900f6c6d9"
/>

## Why are these changes needed?

Improves  editing UI for tools in AGS
- add remove tools 
- add/remove imports 
- show source code section of FunctionTool in  in code editor

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-18 01:24:43 +00:00
Reece Adamson 17888819c2
doc: fix typo (recpients -> recipients) (#5570)
## Why are these changes needed?

Just fixing a very minor typo I noticed while reading the docs.

`recpients` -> `recipients`
2025-02-17 16:17:29 +00:00
Eric Zhu b04775f3dc
Update python version to v0.4.7 (#5558) 2025-02-14 20:08:38 -08:00
Eric Zhu 54681b2aec
fix: Add warning and doc for Windows event loop policy to avoid subprocess issues in web surfer and local executor (#5557) 2025-02-14 18:59:52 -08:00
Eric Zhu 80891b4841
doc & fix: Enhance AgentInstantiationContext with detailed documentation and examples for agent instantiation; Fix a but that caused value error when the expected class is not provided in register_factory (#5555)
Resolves #5519

Also spotted and fixed a bug that caused value error from `register_factory`, when the `expected_class` was not provided.
2025-02-14 18:19:32 -08:00
Eric Zhu 69c0b2b5ef
fix: Add model info validation and improve error messaging (#5556)
Introduce validation for the ModelInfo dictionary to ensure required
fields are present.

Resolves #5501
2025-02-14 18:09:33 -08:00
Eric Zhu a1234bc658
doc: improve tool guide in Core API doc (#5546)
- Add a section on how to use model client with tools
- Replace the obsecure pattern of using ToolAgent with a simpler
implementation of calling tool within the agent itself.
2025-02-14 14:14:51 -08:00
Eric Zhu e7a3c78594
fix: Address tool call execution scenario when model produces empty tool call ids (#5509)
Resolves #5508
2025-02-13 23:11:44 -08:00
Ryan Sweet ff7f863e73
Improve e2e integration tests and isolate tests from other things; includes patch to Serializer (#5497)
* integration tests used to use the samples - now they are separate
* patch dictionary problem in serializer
* add Message Registry with dead letter queue that gets checked on new
subs.
2025-02-13 16:43:57 -08:00
gagb 3abc022ca9
fix: update help text for model configuration argument (#5533)
This pull request includes a small change to the
`python/packages/magentic-one-cli/src/magentic_one_cli/_m1.py` file. The
change modifies the help message for the `--config` argument to remove
the part about leaving it empty to print a sample configuration. This is
already handled by `--sample-config`.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-13 16:07:32 -08:00
Victor Dibia e6423bb862
Make CodeExecutor Serializable/Declarative (#5527)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Make
[PythonCodeExecutionTool](https://github.com/microsoft/autogen/blob/main/python/packages/autogen-ext/src/autogen_ext/tools/code_execution/_code_execution.py)
declarative so it can be used in tools like AGS

Summary of changes

- Make CodeExecutor declarative (convert from Protocol to ABC, inherit
from ComponentBase)
- Make LocalCommandLineCodeExecutor, JupyterCodeExecutor and
DockerCommandLineCodeExecutor declarative , best effort. Not all fields
are serialized, warnings are shown where appropriate.
- Make PythonCodeExecutionTool declarative.

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

Closes #5526 
<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-13 13:50:11 -08:00
Jacob Alber 4e3b88784a
docs: Add Link (and redirect) to .NET docs (#5534)
Pulls the .NET Docs a bit more into the documentation website proper:

* Add a link from the 0.4-series Python docs to 
* Adds a transient redirect from /dotnet/ to /dotnet/dev/ to forward to
the dev docs until we do a non "-dev" release
2025-02-13 12:06:15 -08:00
Eric Zhu ec314c586c
feat: Add strict mode support to BaseTool, ToolSchema and FunctionTool (#5507)
Resolves #4447

For `openai` client's structured output support is through its beta
client, which requires the function JSON schema to be strict when in
structured output mode.

Reference:
https://platform.openai.com/docs/guides/function-calling#strict-mode
2025-02-13 19:44:55 +00:00
Yosua Wijaya 20245b1c7e
Update custom-agents.ipynb (#5531)
Update AutoGen Studio link to stable page url
2025-02-13 16:55:56 +00:00
Jacob Alber 62954ea1cb
fix: Race condition between GrpcWorkerConnection open and agent type registration (#5521)
This finishes the fix for the race condition between opening a
GrpcWorkerConnection and registering agent types on that worker. Now,
instead of failing to register, we return from the call (with the
expectation that we will finish registration as we set up the
connection)

Part 1: #5494 
Part 2: #5514

---------

Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2025-02-12 19:51:49 -05:00
Wei Jen Lu 4765bca736
Fix class name style in document (#5516)
Fixed a wrong class name style in the document and removed trailing whitespace.

Co-authored-by: Wei Jen Lu <weijenlu@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-12 14:57:02 -08:00
Victor Dibia 559aea9f5b
Update Model Client Docs to Mention API Key from Environment Variables (#5515)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

Adds the following blurb to the model clients docs

## API Keys From Environment Variables

In the examples above, we show that you can provide the API key through
the `api_key` argument. Importantly, the OpenAI and Azure OpenAI clients
use the [openai
package](3f8d8205ae/src/openai/__init__.py (L260)),
which will automatically read an api key from the environment variable
if one is not provided.

- For OpenAI, you can set the `OPENAI_API_KEY` environment variable.  
- For Azure OpenAI, you can set the `AZURE_OPENAI_API_KEY` environment
variable.

This is a good practice to explore, as it avoids including sensitive api
keys in your code.



## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-12 13:59:12 -08:00
Jacob Alber 676b611064
fix: Make race condition between channel open and RPC less likely to occur (#5514)
Right now we rely on opening the channel to associate a ClientId with an
entry on the gateway side. This causes a race when the channel is being
opened in the background while an RPC (e.g. MyAgent.register()) is
invoked.

If the RPC is processed first, the gateway rejects it due to "invalid"
clientId.

This fix makes this condition less likely to trigger, but there is still
a piece of the puzzle that needs to be solved on the Gateway side.
2025-02-12 16:40:52 -05:00
Victor Dibia f49f159a43
Support Component Validation API in AGS (#5503)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

It is useful to rapidly validate any changes to a team structure as
teams are built either via drag and drop or by modifying the underlying
spec

You can now “validate” your team. The key ideas are as follows
- Each team is based on some Component Config specification which is a
pedantic model underneath.
- Validation is 3 pronged based on a ValidatorService class 
    - Data model validation (validate component schema)
    - Instantiation validation (validate component can be instantiated)
- Provider validation, component_type validation (validate that provider
exists and can be imported)
- UX: each time a component is **loaded or saved**, it is automatically
validated and any errors shown (via a server endpoint). This way, the
developer immediately knows if updates to the configuration is wrong or
has errors.

> Note: this is different from actually running the component against a
task. Currently you can run the entire team. In a separate PR we will
implement ability to run/test other components.

<img width="1360" alt="image"
src="https://github.com/user-attachments/assets/d61095b7-0b07-463a-b4b2-5c50ded750f6"
/>

<img width="1368" alt="image"
src="https://github.com/user-attachments/assets/09a1677e-76e8-44a4-9749-15c27457efbb"
/>

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

Closes #4616 

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-12 17:29:43 +00:00
Eric Zhu 492b106b19
doc: API doc example for langchain database tool kit (#5498) 2025-02-11 20:15:07 -08:00
Eric Zhu cbc5d0241b
doc: Update AgentChat quickstart guide to enhance clarity and installation instructions (#5499)
Fix the installation instruction and add comments to the code.
2025-02-12 02:50:08 +00:00
Jack Gerrits dc877d5737
Impl remove and get subscription APIs for python xlang (#5365)
Closes #5297

---------

Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
Co-authored-by: Jacob Alber <jaalber@microsoft.com>
Co-authored-by: Jacob Alber <jacob.alber@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-11 14:42:09 -08:00
Andrej Kyselica 540c4fb345
feat: DockerCommandLineCodeExecutor support for additional volume mounts, exposed host ports (#5383)
Add the following additional configuration options to
DockerCommandLineCodeExectutor:

- **extra_volumes** (Optional[Dict[str, Dict[str, str]]], optional): A
dictionary of extra volumes (beyond the work_dir) to mount to the
container. Defaults to None.
- **extra_hosts** (Optional[Dict[str, str]], optional): A dictionary of
host mappings to add to the container. (See Docker docs on extra_hosts)
Defaults to None.
- **init_command** (Optional[str], optional): A shell command to run
before each shell operation execution. Defaults to None. 

## Why are these changes needed?

See linked issue below.

In summary: Enable the agents to:
- work with a richer set of sys admin tools on top of code execution
- add support for a 'project' directory the agents can interact on
that's accessible by bash tools and custom scripts

## Related issue number

Closes #5363

## Checks

- [x] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-02-11 10:17:34 -08:00
Eric Zhu a9db38461f
doc: Update API doc for MCP tool to include installation instructions (#5482) 2025-02-10 23:55:13 -08:00
Victor Dibia cd085e6b89
Improve custom agentchat agent docs with model clients (gemini example) and serialization (#5468)
This PR improves documentation on custom agents 

- Shows example on how to create a custom agent that directly uses a
model client. In this case an example of a GeminiAssistantAgent that
directly uses the Gemini SDK model client.
- Shows that that CustomAgent can be easily added to any agentchat team 
- Shows how the same CustomAgent can be made declarative by inheriting
the Component interface and implementing the required methods.

Closes #5450
2025-02-10 16:29:43 -08:00
Jack Gerrits 2612796681
Implement control channel in python host servicer (#5427)
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-10 23:05:19 +00:00
Eric Zhu 6db946bc89
doc: enhance extensions user guide with component examples (#5480) 2025-02-10 12:43:53 -08:00
Eitan Yarmush 8a9f452136
Adding declarative HTTP tools to autogen ext (#5181)
## Why are these changes needed?
These changes are needed because currently there's no generic way to add
`tools` to autogen studio workflows using the existing DSL and schema
other than inline python.

This API will be quite verbose, and lacks a discovery mechanism, but it
unlocks a lot of programmatic use-cases.

## Related issue number
https://github.com/microsoft/autogen/issues/5170

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-10 20:27:27 +00:00
Eric Zhu 9e15e9529c
doc: improve agent tutorial to include multi-modal input. (#5471)
Have seen discussion on Discord regarding confusion about multi-modal
support in v0.4. This change adds a small note on how to use multi-modal
messages with agents.
2025-02-10 11:29:25 -08:00
Eric Zhu 378b5ac09a
Update version to 0.4.6 (#5477) 2025-02-10 11:22:23 -08:00
Leonardo Pinheiro 50d7587a46
fix: Update SK kernel from tool to use method. (#5469)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->
The current implementation tries to recreate the metadata but it does it
in an incomplete way. This PR uses SK built-in kernel from function
decorator to infer the callable from the `run_json` and makes better use
of the pydantic schemas for the input and output to infer the schema of
the kernel function.

## Related issue number

<!-- For example: "Closes #1234" -->
Closes #5458 

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-10 16:34:54 +10:00
wistuba 7a772a2fcd
feat: add indictor for tool failure to FunctionExecutionResult (#5428)
Some LLMs recieve an explicit signal about tool use failures. 

Closes #5273

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-09 21:57:50 -08:00
Eric Zhu b8c5e499b3
doc: improve m1 docs, remove duplicates (#5460)
Resolves #5358

---------

Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2025-02-10 05:40:02 +00:00
Victor Dibia 340a8e8587
Add notes on api key and modifying specifications in AGS (#5466)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

Add clear notes on how to specify api key and modifying specifications
in AGS.
Add diagrams explaining how to switch between visual builder and JSON
mode

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->


![teambuilder](https://github.com/user-attachments/assets/9eede334-7f60-4c87-bec6-cf41839ba231)


## Related issue number

<!-- For example: "Closes #1234" -->

@nour-bouzid 

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-09 14:46:07 -08:00
Eric Zhu 9a028acf9f
feat: enhance Gemini model support in OpenAI client and tests (#5461) 2025-02-09 10:12:59 -08:00
Richárd Gyikó 5308b76d5f
Add MCP adapters to autogen-ext (#5251)
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-09 05:20:00 +00:00
Victor Dibia 7fc7f383f0
Enable LLM Call Observability in AGS (#5457)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

It is often helpful to inspect the raw request and response to/from an
LLM as agents act.
This PR, does the following:

- Updates TeamManager to yield LLMCallEvents from core library
- Run in an async background task to listen for LLMCallEvent JIT style
when a team is run
   - Add events to   an async queue and 
- yield those events in addition to whatever actual agentchat
team.run_stream yields.
- Update the AGS UI to show those LLMCallEvents in the messages section
as a team runs
   - Add settings panel to show/hide llm call events in messages. 
- Minor updates to default team

<img width="1539" alt="image"
src="https://github.com/user-attachments/assets/bfbb19fe-3560-4faa-b600-7dd244e0e974"
/>
<img width="1554" alt="image"
src="https://github.com/user-attachments/assets/775624f5-ba83-46e8-81ff-512bfeed6bab"
/>
<img width="1538" alt="image"
src="https://github.com/user-attachments/assets/3becbf85-b75a-4506-adb7-e5575ebbaec4"
/>


## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #5440 

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-09 04:50:12 +00:00
Leonardo Pinheiro b868e32b05
fix: update SK adapter stream tool call processing. (#5449)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

The current stream processing of SK model adapter returns on the first
function call chunk but this behavior is incorrect end ends up returning
with an incomplete function call. The observed behavior is that the
function name and arguments are split into different chunks and this
update correctly processes the chunks in this way.

## Related issue number

<!-- For example: "Closes #1234" -->

Fixes the reply in #5420 

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com>
2025-02-09 14:39:19 +10:00
Eric Zhu b5eaab8501
fix & doc: update selector prompt documentation and remove validation checks (#5456) 2025-02-08 18:08:14 -08:00
Eric Zhu 15891e8cef
docs: enhance human-in-the-loop tutorial with FastAPI websocket example (#5455)
Added a websocket example and link to the sample directory.
2025-02-08 15:53:02 -08:00
Eric Zhu 426b898485
fix: improve speaker selection in SelectorGroupChat for weaker models (#5454)
Don't throw an exception when model makes a mistake. Use retries, and if
not succeeding after a fixed attempts, fall back to the previous sepaker
if available, or the first participant.

Resolves #5453
2025-02-08 23:13:46 +00:00
afourney 0b659de36d
Mitigates #5401 by optionally prepending names to messages. (#5448)
Mitigates #5401 by optionally prepending names to messages.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-08 07:04:24 +00:00
Leonardo Pinheiro be085567ea
fix: remove sk tool adapter plugin name (#5444)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

Semantic kernel prepends the plugin name to the tool name when passing
the tools to model clients and this is causing a mismatch between tool
names in SK and the AssistantAgent. Since plugin names are optional, we
have opted to remove it.

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #5420 

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com>
2025-02-08 04:54:05 +00:00
Ryan Sweet edbd20167b
bring back grpc service (#5377)
Restoring the grpc + Orleans server into the project

## Why are these changes needed?

This is the distributed agent runtime for .NET that can manage routing
messages amongst a fleet of grpc agent runtimes.

## Related issue number

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Jack Gerrits <jack@jackgerrits.com>
Co-authored-by: Jacob Alber <jaalber@microsoft.com>
2025-02-07 19:28:55 -05:00
Victor Dibia 9494ac97a0
AGS Improvements (Add Test Button in Team Builder View + Others) (#5416)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

- Add ability to test teams in Team Builder view 
- Update Gallery (add deep research default team, fix bug with gallery
serialization)
- UI fixes 
   -  improve drag drop component experience 
- improve new session experience (single click rather than 3 clicks to
create a session)
   - fix bug with stop reason not being shown in some cases

<img width="1738" alt="Image"
src="https://github.com/user-attachments/assets/4b895df2-3bad-474e-bec6-4fbcbf1c4346"
/>

<img width="1761" alt="Image"
src="https://github.com/user-attachments/assets/65f52eb9-e926-4168-88fb-d2496c159474"
/>

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

Closes #5392

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-07 23:37:44 +00:00
Rohan Thacker 73a7ba5764
Added the Claude family of models to ModelFamily (#5443)
Added the Claude family of models to the `ModelFamily` class. 

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-07 23:27:14 +00:00
Eric Zhu 0008c9cb44
fix: do not count agent event in MaxMessageTermination condition (#5436)
Resolves #5425
2025-02-07 20:52:08 +00:00
abhijeethaval 707c3cf655
Update teams.ipynb : In the sample code the termination condition is set to the text "APPROVE" but the documentation mentions "TERMINATE" (#5426)
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-07 20:41:01 +00:00
Eric Zhu abdc0da4f1
Add sample chat application with FastAPI (#5433)
Introduce a sample chat application using AgentChat and FastAPI,
demonstrating single-agent and team chat functionalities, along with
state persistence and conversation history management.

Resolves #5423

---------

Co-authored-by: Victor Dibia <victor.dibia@gmail.com>
Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-02-07 20:17:56 +00:00
afourney f20ba9127d
M1 docker (#5437)
Presently MagenticOne and the m1 CLI use the LocalCommandLineExecutor
(presumably copied from the agbench code, which already runs in Docker).

This pr defaults m1 to Docker, and adds a code_executor parameter to
MagenticOne, which defaults to local for now to maintain backward
compatibility -- but this behavior is immediately deprecated.
2025-02-07 20:08:28 +00:00
Wei Jen Lu 5fcb3b8061
Fix typo in Swarm doc (#5435)
Fix typo in Swarm doc
2025-02-07 11:58:56 -08:00
so2liu 07c5dc7514
fix: streaming token mode cannot work in function calls and will infi… (#5396)
Fix: Prevent empty messages accumulation in streaming mode

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-07 10:42:27 -08:00
Eric Zhu 901ab1276d
feat: enhance AzureAIChatCompletionClient validation and add unit tests (#5417)
Resolves #5414
2025-02-07 18:32:14 +00:00
afourney af5dcc7fdf
Significant updates to agbench. (#5313)
- Updated HumanEval template to use AgentChat
- Update templates to use config.yaml for model and other configuration
- Read environment from ENV.yaml (ENV.json still supported but
deprecated)
- Temporarily removed WebArena and AssistantBench. Neither had viable
Templates after `autogen_magentic_one` was removed. Templates need to be
update to AgentChat (in a future PR, but this PR is getting big enough
already)
2025-02-07 18:01:44 +00:00
Jack Gerrits f7f5507c70
Split out GRPC tests (#5431) 2025-02-07 16:57:30 +00:00
afourney 4c1c12d350
Flush console output after every message. (#5415) 2025-02-06 22:20:06 -08:00
afourney 3c30d8961e
Prompting changes to better support smaller models. (#5386)
A series of changes to the
`python/packages/autogen-ext/src/autogen_ext/agents/web_surfer/_multimodal_web_surfer.py`
file have been made to better support smaller models.

This includes changes to the prompts, state descriptions, and ordering
of messages.

Regression tasks with OpenAI models shows no change in GAIA scores,
while scores for Llama are significantly improved.
2025-02-06 17:47:55 -08:00
afourney 59e392cd0f
Get SelectorGroupChat working for Llama models. (#5409)
Get's SelectorGroupChat working for llama by:

1. Using a UserMessage rather than a SystemMessage
2. Normalizing how roles are presented (one agent per line)
3. Normalizing how the transcript is constructed (a blank line between
every message)
2025-02-06 16:03:17 -08:00
Jack Gerrits 25f26a338b
Updates to proto for state apis (#5407) 2025-02-06 16:54:21 -05:00
Jack Gerrits ca428914f5
Refactor grpc channel connection in servicer (#5402) 2025-02-06 13:53:24 -05:00
afourney cf798aef3f
Various web surfer fixes. (#5393)
This PR fixes:

A prompting bug when no control had focus.
Awkward prompt phrasing.
Renamed page_down to scroll_down to better match other prompting and
agent descriptions.
2025-02-05 22:17:18 -08:00
afourney ac74305913
Ensure decriptions appear each on one line. Fix web_surfer's desc (#5390)
Some agent descriptions were split over multiple lines in the M1
orchestrator. This PR ensures that each description appears on one, and
only one, line. This makes it easier for smaller models to understand.
2025-02-05 20:17:24 -08:00
afourney d86540e9cd
Fix summarize_page in a text-only context, and for unknown models. (#5388)
WebSurfer's summarize_page was failing when the model was text-only, or
unknown.
2025-02-06 00:57:46 +00:00
Wei Jen Lu 7947464e4a
Fixed example code in doc:Custom Agents (#5381)
The Tuple class is never used in CountDownAgent class.

<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [x] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-02-06 00:52:32 +00:00
Eitan Yarmush 172a16a615
Memory component base (#5380)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Currently the way to accomplish RAG behavior with agent chat,
specifically assistant agents is with the memory interface, however
there is no way to configure it via the declarative API.

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Co-authored-by: Victor Dibia <chuvidi2003@gmail.com>
2025-02-05 16:07:27 -08:00
Wei Jen Lu 9030f75b4d
Fix typo (#5361)
Just fix typo

<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [x] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-05 09:57:39 -05:00
Leonardo Pinheiro 5c969d3f10
fix: add state management for oai assistant (#5352)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

To allow serialization of OAI Assistant Agent.

## Related issue number

<!-- For example: "Closes #1234" -->

Closes #5130 

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-04 21:56:30 +00:00
Eric Zhu 68cc2e1019
docs(python): add instructions for syncing dependencies and checking samples (#5362)
Address some common questions.
2025-02-04 19:35:51 +00:00
Jack Gerrits 40d74a32a1
Use proto descriptor for typename (#5346)
Closes #5302
2025-02-04 19:18:16 +00:00
Victor Dibia 6454e3fece
fix permission issue in ags windows (#5360)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Fix permission issue in ags windows (env files now stored in a user
directory)

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->
Closes #5355
## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-04 10:23:46 -08:00
afourney cf6fa77273
Add text-only model support to M1 (#5344)
Modify M1 agents to support text-only settings.
This allows M1 to be used with models like o3-mini and Llama3.1+
2025-02-04 08:25:48 -08:00
afourney 517e3f000e
Assistant agent drop images when not provided with a vision-capable model. (#5351)
Allow AssistantAgent to drop images when not equipped with a multi-modal model.

Adds a corresponding utility function, which can be used in autogen-ext and teams, to accomplish the same.
2025-02-04 14:55:04 +00:00
Juan 5df5bde127
docs(core_distributed-group-chat): fix the typos in the docs in the README.md (#5347)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Wrong file names in the README.md

## Related issue number



## Checks

- [x] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

Co-authored-by: Mohammad Mazraeh <Mazraeh.Mohammad@Gmail.com>
2025-02-04 07:13:03 +00:00
Victor Dibia b89ca2a5ae
Fix warnings in AGS (#5320)
This PR does the following: 

- Fix warning messages in AGS on launch.
- Improve Cli message to include app URL on startup from command line
- Minor improvements default gallery generator. (add more default tools)
- Improve new session behaviour.



## Related issue number

Closes #5097

## Checks
2025-02-04 06:32:34 +00:00
Victor Dibia fbda70320d
Ensure ModelInfo field is serialized for OpenAIChatCompletionClient (#5315)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Fix bug where the `model_info` field is not serialized for the
`OpenAIChatCompletionClient` class. This was because the `_raw_config`
field was based on a version of the args that had been sanitized
(model_info removed). We need the full model info field for non-openai
models

```python
from autogen_ext.agents.web_surfer import MultimodalWebSurfer
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_core.models import ModelInfo
mistral_vllm_model = OpenAIChatCompletionClient(
    model="TheBloke/Mistral-7B-Instruct-v0.2-GGUF",
    base_url="http://localhost:1234/v1",
    api_key="empty",
    model_info=ModelInfo(vision=False, function_calling=True, json_output=False, family="unkown"),
)
(mistral_vllm_model.dump_component().model_dump_json())
```

Before
```
{
  "provider": "autogen_ext.models.openai.OpenAIChatCompletionClient",
  "component_type": "model",
  "version": 1,
  "component_version": 1,
  "description": "Chat completion client for OpenAI hosted models.",
  "label": "OpenAIChatCompletionClient",
  "config": {
    "model": "TheBloke/Mistral-7B-Instruct-v0.2-GGUF",
    "api_key": "empty",
    "base_url": "http://localhost:1234/v1"
  }
}

```

After
```
{
  "provider": "autogen_ext.models.openai.OpenAIChatCompletionClient",
  "component_type": "model",
  "version": 1,
  "component_version": 1,
  "description": "Chat completion client for OpenAI hosted models.",
  "label": "OpenAIChatCompletionClient",
  "config": {
    "model": "TheBloke/Mistral-7B-Instruct-v0.2-GGUF",
    "api_key": "empty",
    "model_info": {
      "vision": false,
      "function_calling": true,
      "json_output": false,
      "family": "unkown"
    },
    "base_url": "http://localhost:1234/v1"
  }
}


```
<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-04 05:51:38 +00:00
afourney e8f49ef386
Fix reading string args from m1 cli (#5343)
After #5431 some command-line arguments became string rather than lists.
This PR fixes the issue by checking the type.
2025-02-03 13:27:37 -08:00
afourney cd88757cac
Allow m1 cli to read a configuration from a yaml file. (#5341)
Allow m1 cli to read a configuration from a yaml file.
2025-02-03 20:11:42 +00:00
razvanvalca 3d00457993
Adding o3 family: o3-mini (#5325)
## Why are these changes needed?
This pull request introduces the 'o3' model family and adds support for
the 'o3-mini' model.

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-03 18:57:21 +00:00
Mohammad Mazraeh 06c706633d
fix: warn on empty chunks, don't error out (#5332)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

We are seeing this issue more often now, probably related to the load on
the API servers. Hence this PR:
1. Demotes the the `max_consecutive_empty_chunk_tolerance` parameter
from function to inline threshold
2. Change exception to a one time warning

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [x] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.

---------

Signed-off-by: Mohammad Mazraeh <mazraeh.mohammad@gmail.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-02-03 18:45:29 +00:00
Eric Zhu 569bc19769
feat: add gemini model families, enhance group chat selection for Gemini model and add tests (#5334)
Resolves #5322
2025-02-03 18:32:35 +00:00
afourney 877796ded1
WebSurfer: print viewport text (#5329)
This PR adds a method that approximately extracts the text visible in
the viewport of the web browser (as opposed to always printing the first
50 lines, or relying entirely on OCR).
2025-02-03 11:42:18 -05:00
Eric Zhu 756e2a4865
feat: update OpenAIAssistantAgent to support AsyncAzureOpenAI client (#5312)
Resolves #5179
2025-01-31 16:09:11 -08:00
Nour Bouzid 0bf786fbb6
Add default_header support (#5249)
Closes #5163
---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-01-31 16:03:32 -08:00
afourney 088a50faa5
Remove old autogen_magentic_one package. (#5305)
This PR removes the older `autogen_magentic_one` package, and directs
people to use the new AgentChat implementation.

Hopefully this eases confusion.

---------

Co-authored-by: Jack Gerrits <jack@jackgerrits.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-01-31 15:14:40 -08:00
Eric Zhu cd9dca4740
feat: add o3 to model info; update chess example (#5311)
Because.
2025-01-31 15:07:14 -08:00
Eric Zhu 69d3af7324
Add a new sample to show streaming and R1 usage (#5285)
* New sample of chess playing showing R1's thought process in streaming
mode
* Modify existing samples to use `model_config.yml` instead of JSON
configs for better clarity.

---------

Co-authored-by: Mohammad Mazraeh <Mazraeh.Mohammad@Gmail.com>
2025-01-31 22:25:29 +00:00
Eric Zhu 88c895fd48
sample: Update chainlit sample with streaming (#5304)
* Separate agent and team examples
* Add streaming output
* Refactor to better use the chainlit API
* Removed the user proxy example -- this needs a bit more work to
improve the presentation on the ChainLit interface.

---------

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-01-31 22:20:11 +00:00
Eric Zhu d5007adba7
chore: add asyncio_atexit dependency to docker requirements (#5307)
Resolves #5281
2025-01-31 14:14:43 -08:00
Eric Zhu 3cc9095f28
fix: type issues in streamlit sample and add streamlit to dev dependencies (#5309) 2025-01-31 14:06:59 -08:00
Hussein Koprly 75968565a1
adding streamlit sample app (#5306)
- New Streamlit sample app using autogen
- README added on how to run it
2025-01-31 12:19:16 -08:00
Griffin Bassman b5626262b4
fix: windows check ci failure (#5287) 2025-01-31 10:22:15 -08:00
linznin 33d9bd6d1d
Update Distributed Agent Runtime Cross-platform Sample (#5164)
fix: improve service shutdown handling in for cross-platform compatibility (#5124)

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-01-31 16:17:04 +00:00
Eric Zhu 71bf20b8a2
chore: update package versions to 0.4.5 and remove deprecated requirements (#5280) 2025-01-31 01:52:45 +00:00
Victor Dibia b2800d729b
Update AGS to Use AgentChat Declarative Config Serialization (#5261)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

This PR updates AGS to use the declarative config serialization native
to AgentChat.
The effect? You can build your teams/artifacts directly in python, run
`team.dump_component()` and immediately run it in AGS.

Some change details:

- Removes ComponentFactory. Instead TeamManager just loads team specs
directly using `Team.load_component`.
- Some fixes to the UI to simplify drag and drop experience.  
- Improve layout of nodes...


<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->
Closes #4439 
Closes #5172

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.


cc @EItanya @nour-bouzid
2025-01-31 00:24:37 +00:00
Eric Zhu f656ff1e01
feat: Support R1 reasoning text in model create result; enhance API docs (#5262)
Resolves #5255 

---------

Co-authored-by: afourney <adamfo@microsoft.com>
2025-01-30 11:03:54 -08:00
Eric Zhu 44db2cc1fb
fix: handle non-string function arguments in tool calls and add corresponding warnings (#5260) 2025-01-30 16:49:22 +00:00
afourney aa23093f36
Adjusted M1 agent system prompt to remove TERMINATE (#5263)
Removed the TERMINATE clause from the system prompt since M1 handles
termination via the Orchestrator, and it is just ignored.

Removed the clause about saving to a particular file name, since tmp_
files are created in the current CodeExecutors.
2025-01-30 08:14:55 -08:00
afourney fff201f813
Added an optional sources parameter to CodeExecutorAgent (#5259)
This PR adds a `sources` optional parameter to CodeExecutorAgent
(similar to the termination conditions), that allows finer-grained
control on which agents can provide code for execution.

It also moves the `_extract_markdown_code_blocks` subroutine to a member
method, so that it can be overridden by subclasses. I've found this to
be very important to support benchmarks like HumanEval, where we need to
add a test harness around the implementation.
2025-01-29 23:28:57 -08:00
Eric Zhu 403844ef2b
feat: add Semantic Kernel Adapter documentation and usage examples in user guides (#5256)
Partially address #5205 and #5226
2025-01-29 16:37:18 -08:00
Eric Zhu 7020f2ac34
fix: update human-in-the-loop tutorial with better system message to signal termination condition (#5253)
Resolves #5248
2025-01-29 10:53:37 -08:00
Nour Bouzid 02e968a531
FunctionTool partial support (#5183)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

FunctionTool supports passing in a partial

## Related issue number

Closes #5151 

## Checks

- [x] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-01-29 18:02:18 +00:00
Mohammad Mazraeh 2f1684b698
update dependencies to work with protobuf 5 (#5195)
Closes #5074

Signed-off-by: Mohammad Mazraeh <mazraeh.mohammad@gmail.com>
2025-01-28 22:11:54 -08:00
Eric Zhu 225eb9d0b2
feat: introduce ModelClientStreamingChunkEvent for streaming model output and update handling in agents and console (#5208)
Resolves #3983

* introduce `model_client_stream` parameter in `AssistantAgent` to
enable token-level streaming output.
* introduce `ModelClientStreamingChunkEvent` as a type of `AgentEvent`
to pass the streaming chunks to the application via `run_stream` and
`on_messages_stream`. Although this will not affect the inner messages
list in the final `Response` or `TaskResult`.
* handle this new message type in `Console`.
2025-01-29 02:49:02 +00:00
Eric Zhu 10996bc172
docs: Enhance documentation for SingleThreadedAgentRuntime with usage examples and clarifications; undeprecate process_next (#5230)
Resolves #5046
2025-01-28 11:03:51 -08:00
Eric Zhu b29d0bda2f
update versions to 0.4.4 and m1 cli to 0.2.3 (#5229) 2025-01-28 17:59:14 +00:00
Jack Gerrits 7445e4b276
Remove channel based control plane APIs, cleanup proto (#5236) 2025-01-28 11:15:57 -05:00
Rohan Thacker d49bf346e0
Updated docs for _azure_ai_client.py (#5199)
Update a minor typo and updated the `response_format` documentation to
the new value

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-01-27 23:19:38 +00:00
Eric Zhu 2ceb9dcffe
docs: Update user guide notebooks to enhance clarity and add structured output (#5224)
Resolves #5043
2025-01-27 13:57:29 -08:00
Victor Dibia 6359b6a7be
improve component config, add description support in dump_component (#5203)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

It is currently hard to add a description to a component (defaults to
None also) .. you have to call super.dump() modify and return. This PR
makes the experience better.

- allows you specify `component_description` and `component_label` as an
optional class var. label is an optional human readable name for the the
component.
- will use component_description if provided int he description field
when dumped if there is no description, will use the first line of class
docstring. Takes advantage of all the good practices we have in writing
good docstrings. label defaults to component type.
 

For example 

```python
model_client=OpenAIChatCompletionClient( model="gpt-4o-2024-08-06" )
config = model_client.dump_component()
print(config.model_dump_json())
```
Note the description field below is no longer None and there is a label
```python
{
  "provider": "autogen_ext.models.openai.OpenAIChatCompletionClient",
  "component_type": "model",
  "version": 1,
  "component_version": 1,
  "description": "Chat completion client for OpenAI hosted models.",
  "label": "OpenAIChatCompletionClient",
  "config": { "model": "gpt-4o-2024-08-06" }
}


```

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->
None, felt faster to fix.

## Checks

- [x] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.
2025-01-27 21:41:23 +00:00
Eric Zhu b441d5b43a
fix: Enhance OpenAI client to handle additional stop reasons and improve tool call validation in tests to address empty tool_calls list. (#5223)
Resolves #5222
2025-01-27 21:16:47 +00:00
Christoph Schittko 8428462513
Update literature-review.ipynb to fix possible copy-and-paste error (#5214)
Typo in Report Agent

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-01-27 17:36:28 +00:00
Eric Zhu e582072947
Update model client documentation add Ollama, Gemini, Azure AI models (#5196)
Partially resolves: #5118

Once the extension page is ready, update the tutorial pages to reduce
duplication.

---------

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
2025-01-26 18:42:57 +00:00
Bilawal Hameed 42dc80ce60
docs: s/Exisiting/Existing/g (#5202) 2025-01-26 02:18:46 +00:00
Eric Zhu 138913bd5b
Add Model Client Cache section to migration guide (#5197) 2025-01-25 21:26:49 +00:00
Sachin Joglekar 8926206479
Implement default in-memory store for ChatCompletionCache (#5188) 2025-01-25 21:07:58 +00:00
Victor Dibia 67029853ec
make AssistantAgent and Handoff use BaseTool (#5193)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Make AssistantAgent and Handoff use BaseTool.  
This ensures that they can be made declarative/serialized

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-01-25 12:04:05 -08:00
Ryan Sweet b6597fdd24
rysweet-unsubscribe-and-agent-tests-4744 (#4920)
* add tests for core functionality and client/server
* add remove subscription, get subscriptions
* fix LOTS of bugs
* add grpc tuning
* adapt to latest agreed agents_worker proto changes.
2025-01-24 19:24:00 -08:00
Jack Gerrits 55e929db98
Impl register and add sub RPC (#5191)
* Refactor client id retrieval

* WIP

* fixes

* future annotations

* Fix tests

* remove import
2025-01-24 18:58:33 -05:00
Leonardo Pinheiro db2410c705
Feature/azure ai inference client (#5153)
* Rebase to latest main branch

* Moved _azure module to azure

* Validate extra_create_args in and json response

* Added Support for Github Models

* Added normalize_name and assert_valid name

* Added Tests for AzureAIChatCompletionClient

* WIP: Azure AI Client

* Added: object-level usage data
* Added: doc string
* Added: check existing response_format value
* Added: _validate_config and _create_client

* lint

* merge dependencies

* add tests for img and function calling

* support actual tests through env vars

* address mypy errors

* doc example fix

* fmt

* fix doc fmt

* Update python/packages/autogen-ext/src/autogen_ext/models/azure/_azure_ai_client.py

---------

Co-authored-by: Rohan Thacker <thackerrohan4@gmail.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com>
2025-01-25 08:26:48 +10:00
Jack Gerrits 1982f1b0ec
Improve grpc type checking (#5189) 2025-01-24 12:34:59 -08:00
Eric Zhu 146674399b
docs: Core API doc update: split out model context from model clients; separate framework and components (#5171) 2025-01-24 19:17:07 +00:00
Jack Gerrits b375d4b18c
Communicate client id via metadata in grpc runtime (#5185)
Communicate client id via metadata
2025-01-24 13:41:31 -05:00
Gerardo Moreno 89631966cb
RichConsole: Prettify m1 CLI console using rich #4806 (#5123) 2025-01-24 09:50:38 -08:00
Mohammad Mazraeh 0de4fd83d1
Add dependencies to distributed group chat example (#5175)
add dependencies to distributed group chat example
2025-01-24 08:49:53 -05:00
Victor Dibia 979d8ab4f1
Make AgentChat Team Config Serializable (#5071)
* initial pass on making group chats declarative

* update group chat tests

* update impl to include participant serialization for all teams

* v1 making soc declarative

* update memory test

* update chatagent and team base classes

* update serialization doc notebook

* fomating updates
2025-01-24 07:08:22 +00:00
Victor Dibia 58d789a249
Make FunctionTools Serializable (Declarative) (#5052)
* vi1 for declarative tools

* make functtools declarative

* add tests

* update imports

* update formatting

* move tests, format fixes

* format updates

* update test

* add user warning to _from_config

* add warning on load_component to docs

---------

Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2025-01-24 03:49:43 +00:00
Jack Gerrits 44b9bff466
Update proto to include remove sub, move to rpc based operations (#5168)
* Update proto to include remove sub, move to rpc based operations

* dont add a breaking change

* mypy fix
2025-01-23 22:46:47 +00:00
Pierre c3e84dc5ca
Fix function tool naming to avoid overriding the name input (#5165)
fix function tool naming to avoid overriding the name input
2025-01-23 10:42:54 -05:00
Sungjun.Kim 141247f6d7
docs: Add a helpful comment to swarm.ipynb (#5145)
This notebook file is shown in https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/swarm.html#agents.
However, if users copy some codes as it is and run it as a script, an error occurs.
To prevent such a case, I think adding this comment helps most users.

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-01-23 02:16:09 -08:00
Fernando Bellido Pazos a585091406
Closes #5059 (#5156)
Update _magentic_one_orchestrator.py

In a Magentic Group Settting, if one of the Assitant Agents uses a tool it gives the following error, note this is under a FALSE reflect_on_tool variable.

Making it true, wont happen, though more tokens will be consumed and it will have a worst output and the philosophy of a tool as an answer is not followed...
2025-01-23 02:04:35 -08:00
Leonardo Pinheiro 3fe106621e
fix: update SK model adapter constructor (#5150)
* update constructor

* fix typing error

* revert/fix doc changes

* add unsaved changes

---------

Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com>
2025-01-23 14:53:39 +10:00
Victor Dibia 5e9b24c3d9
Make Memory and Team an ABC (#5149)
* make memory and team an ABC

* update memory test

* update tests
2025-01-22 15:51:34 -08:00
Jack Gerrits 226b37d07b
Make ChatAgent an ABC (#5129) 2025-01-21 20:08:53 -05:00
Eric Zhu da1c2bf12e
fix: use tool_calls field to detect tool calls in OpenAI client; add integration tests for OpenAI and Gemini (#5122)
* fix: use tool_calls field to detect tool calls in OpenAI client

* Add unit tests for tool calling; and integration tests for openai and gemini
2025-01-21 09:06:19 -05:00
Mario Hammer e0a6a86b12
fix a small typo (#5120)
Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-01-20 21:52:52 +00:00
Eric Zhu 142e102ce8
fix: update gpt-4o model version to 2024-08-06 (#5117)
Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2025-01-20 21:15:04 +00:00
Eric Zhu af420a83e2
fix: ensure proper handling of structured output in OpenAI client and improve test coverage for structured output (#5116) 2025-01-20 20:54:39 +00:00
Eric Zhu 8df86e2b72
docs: enhance Swarm user guide with notes on tool calling (#5103) 2025-01-20 12:49:32 -08:00
Leon De Andrade d9fd39a297
Add sources field to TextMentionTermination (#5106) 2025-01-19 23:21:29 -08:00
Leon De Andrade 34bc82e24f
Jupyter Code Executor in v0.4 (alternative implementation) (#4885) 2025-01-18 21:11:40 +00:00
Leonardo Pinheiro 918292f51e
Semantic kernel model adapter (#4851)
* initial sk model adapter implementation

* add sk tool module

* implement streaming and update tests

* update lock

* linting

* add semantic kernel extras

* add docstring and format

* update dependencies and format/lint

* add model info to sk constructor

* update uv.lock

* customize prompt settings

* update uv.lock

* add docs

* fix sk docstring linting

* update create docstrings

* fmt and improve tool docstring

* update sk tool docs

* coerce doc json serialization failure

---------

Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com>
2025-01-18 18:57:20 +10:00
Eric Zhu 9b1260dd3e
docs: update AssistantAgent documentation with a new figure, attention and warning notes (#5099)
* docs: update AssistantAgent documentation with attention and warning notes

* update

---------

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
2025-01-17 23:49:02 +00:00